Skip to content

Instantly share code, notes, and snippets.

@KartikTalwar
KartikTalwar / tiny.c
Created July 12, 2012 04:37
Tiny-C Compiler
/* file: "tinyc.c" */
/* Copyright (C) 2001 by Marc Feeley, All Rights Reserved. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* This is a compiler for the Tiny-C language. Tiny-C is a
@hikui
hikui / NSData+HG_DataHealing.h
Last active January 16, 2025 02:52
如果在GB18030编码的文字中,有几个不合法的字节。本类可以将这些不合法的字节变成“?”,防止转NSString时出现nil。
//
// NSData+HG_DataHealing.h
// HGDataHealing
//
// Created by 缪 和光 on 14-3-7.
// Copyright (c) 2014年 Hokuang. All rights reserved.
//
#import <Foundation/Foundation.h>
@xkortex
xkortex / entry.sh
Last active January 16, 2025 02:47
dockerfile entrypoint for activating conda environment
#!/bin/bash
## Entrypoint for docker RUN directives as well as ENTRYPOINT with conda env
## Enable by adding:
## COPY entry.sh ./
## SHELL ["/entry.sh", "/bin/bash", "-c"]
##
## Optionally, set the following env to select a conda env to run in
## ENV CONDA_DEFAULT_ENV=foo
## You may also want to add something like
## RUN conda init bash && echo 'conda activate "${CONDA_TARGET_ENV:-base}"' >> ~/.bashrc
@lenalebt
lenalebt / DefaultKeyBinding.dict
Created December 18, 2019 06:59
How to use a typical Linux / Windows Keybindung on MacOS (tested with 10.15.2 Catalina)
/*
PUT THIS FILE IN ~/Library/KeyBindings/DefaultKeyBinding.dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more closely
match default behavior on Windows systems. This particular mapping assumes
that you have also switched the Control and Command keys already.
This key mapping is more appropriate after switching Ctrl for Command in this menu:
Apple->System Preferences->Keyboard & Mouse->Keyboard->Modifier Keys...->
Change Control Key to Command
Change Command key to Control
@Stono
Stono / 99-install-facetime-camera.sh
Created February 27, 2017 10:35
Install the kernal module required for the facetimehd camera to work on Linux
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
export KERNELRELEASE=${1}
echo "Installing FacetimeHD camera for $KERNELRELEASE"
cd /tmp
git clone https://github.com/patjak/bcwc_pcie.git
@sebble
sebble / stars.sh
Last active January 16, 2025 02:45
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
@bmhatfield
bmhatfield / .zshrc
Last active January 16, 2025 02:42
OSX Keychain Environment Variables
# If you use bash, this technique isn't really zsh specific. Adapt as needed.
source ~/keychain-environment-variables.sh
# AWS configuration example, after doing:
# $ set-keychain-environment-variable AWS_ACCESS_KEY_ID
# provide: "AKIAYOURACCESSKEY"
# $ set-keychain-environment-variable AWS_SECRET_ACCESS_KEY
# provide: "j1/yoursupersecret/password"
export AWS_ACCESS_KEY_ID=$(keychain-environment-variable AWS_ACCESS_KEY_ID);
export AWS_SECRET_ACCESS_KEY=$(keychain-environment-variable AWS_SECRET_ACCESS_KEY);
@othyn
othyn / guide.md
Last active January 16, 2025 02:40
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid

Intro

Out of the box, my SMB performance on macOS 12.3.1 would top out at around 20MB/s in short ~5 second bursts, which was absolutely horrendous, slow to navigate in Finder and slugish to interact with.

Since making these changes, I now get sustained ~80-100MB/s+ and instant Finder navigation which is superb and how things should be out-of-the-box (OOTB)!

May 2023 update: As of Ventura, the SMB issues were just horribly inconsistent and hard to maintain. Something in the combination of Unraid, macOS and SMB just doesn't play nice. I ended up binning NFS/SMB all together and heading to a locally hosted Nextcloud instance for file syncing, then using SFTP/Ansible Git flow for editing files within appdata.

Sources

@nathanshipley
nathanshipley / img2img_FLUX_ReduxDepth_NS_02_2024-12-09.json
Last active January 16, 2025 02:37
img2img_FLUX_ReduxDepth_NS_02_2024-12-09
{
"last_node_id": 457,
"last_link_id": 804,
"nodes": [
{
"id": 4,
"type": "SetNode",
"pos": [
-433,
2
@kshiteesh
kshiteesh / urlsafari
Last active January 16, 2025 02:37
This AppleScript saves all the tabs open in all Safari windows to a Markdown file.
(*
Export All Safari Tabs in All Open Windows to a Markdown File
July 13, 2015
// SCRIPT PAGE
http://hegde.me/urlsafari
// ORIGINAL SCRIPT ON WHICH THIS SCRIPT IS BUILT
http://veritrope.com/code/export-all-safari-tabs-to-a-text-file