Skip to content

Instantly share code, notes, and snippets.

@firexcy
firexcy / readme.md
Last active March 6, 2023 10:14
DIY a Rewind.ai
View readme.md

This Gist provides a solution to periodically capture screenshots of your Mac, and create therefrom a searchable PDF archive so that you can always get an answer to the “what, when, and where” questions about your usages.

To use these scripts:

  1. Download the shell script rewind, then:
    1. put it under ~/bin (or other fixed path you prefer);
    2. execute
@xirkus
xirkus / yubikey+gpupgp+ssh_howto.md
Last active March 6, 2023 10:13
Security Adventures 1. How to get yubikey+gpg+ssh+gitbhub working on MacOS
View yubikey+gpupgp+ssh_howto.md

I've spent the day trying to get this setup working with GitHub and given the number of gotcha's I encountered, it seemed like a good idea to document how I finally got this working with as few hacks as possible. There's a lot of documentation out there (some of it old and misleading) and committing here for posterity will help me remember this when I inevitably need to do this again.

Rationale

Passwords are simply not enough these days. Regardless of the company, breaches (and the associated Personally Identifiable Information harvested) are a matter of not if, but when. There are a number of things you can do to protect yourself, but being on the tin-foil-hat side of paranoia, means there are a few Commandents that I adhere to (and recommend for other folks)[Insert link to Fight Club Rules for the Secure Internet].

That being said, if you use 2-factor authentication and have committed to using a hardware token such as the Yubikey, then you're already ahead of the curve. The problem is that wh

@hediet
hediet / main.md
Last active March 6, 2023 10:12
Proof that TypeScript's Type System is Turing Complete
View main.md
type StringBool = "true"|"false";


interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };

type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
@Quick104
Quick104 / readme.md
Last active March 6, 2023 10:11
Expose a server behind CG:NAT via Wireguard
View readme.md
@ihoneymon
ihoneymon / how-to-write-by-markdown.md
Last active March 6, 2023 10:10
마크다운(Markdown) 사용법
View how-to-write-by-markdown.md

[공통] 마크다운 markdown 작성법

영어지만, 조금 더 상세하게 마크다운 사용법을 안내하고 있는 "Markdown Guide (https://www.markdownguide.org/)" 를 보시는 것을 추천합니다. ^^

아, 그리고 마크다운만으로 표현이 부족하다고 느끼신다면, HTML 태그를 활용하시는 것도 좋습니다.

1. 마크다운에 관하여

@deadalusai
deadalusai / tasks.json
Last active March 6, 2023 10:08
VS Code tasks.json for Rust/Cargo
View tasks.json
/*
Before using this tasks.json you may like to consider trying one of the following VS Code extensions:
rust-analyzer
Marketplace: https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer
Source: https://github.com/rust-analyzer/rust-analyzer
rls
Marketplace: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Source: https://github.com/rust-lang/rls-vscode
@R3DHULK
R3DHULK / snake-and-ladder.r
Created March 6, 2023 10:07
Snake And Ladder In R
View snake-and-ladder.r
# Create a list of snakes and ladders
game_board <- list(`3` = 17, `7` = 11, `19` = 2, `21` = 9, `27` = 4, `26` = 10)
# Set the initial position and number of moves
position <- 0
moves <- 0
# Play the game
while (position < 30) {
# Roll the dice
@shawwn
shawwn / example.sh
Created March 6, 2023 05:17
How I run 65B using my fork of llama at https://github.com/shawwn/llama
View example.sh
mp=1; size=7B; # to run 7B
mp=8; size=65B; # to run 65B
for seed in $(randint 1000000)
do
export TARGET_FOLDER=~/ml/data/llama/LLaMA
time python3 -m torch.distributed.run --nproc_per_node $mp example.py --ckpt_dir $TARGET_FOLDER/$size --tokenizer_path $TARGET_FOLDER/tokenizer.model --seed $seed --max_seq_len 2048 --max_gen_len 2048 --count 0 | tee -a ${size}_startrek.txt
done
@jcward
jcward / Readme.txt
Created April 14, 2017 15:08
Generating iOS P12 / certs without Mac OSX Keychain (on linux, windows, etc)
View Readme.txt
1) Generate a private key and certificate signing request:
openssl genrsa -out ios_distribution.key 2048
openssl req -new -key ios_distribution.key -out ios_distribution.csr -subj '/emailAddress=me@example.com, CN=Example, C=US'
2) Upload CSR to apple at: https://developer.apple.com/account/ios/certificate/create
- choose Production -> App Store and Ad Hoc
3) Download the resulting ios_distribution.cer, and convert it to .pem format:
@Lewiscowles1986
Lewiscowles1986 / extract_har.py
Last active March 6, 2023 10:07 — forked from kafran/extract_har.py
Python 3 script to extract images from HTTP Archive (HAR) files
View extract_har.py
import json
import base64
import os
# make sure the output directory exists before running!
folder = os.path.join(os.getcwd(), "imgs")
with open("src.har", "r") as f:
har = json.loads(f.read())