Skip to content

Instantly share code, notes, and snippets.

View jason-s-yu's full-sized avatar

Jason Yu jason-s-yu

  • Los Angeles, CA
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 15, 2024 09:51
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@prwhite
prwhite / Makefile
Last active October 2, 2024 03:13
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@mariozig
mariozig / migrate_repo.sh
Last active September 16, 2024 18:48
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror [email protected]:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@JamesOBenson
JamesOBenson / Generating a secure SSH Key and commands
Last active October 16, 2023 06:45
SSH Generation and commands.
ssh-keygen
-t ed25519 - for greatest security (bits are a fixed size and -b flag will be ignored)
-t rsa - for greatest portability (key needs to be greater than 4096 bits)
-t ecdsa - faster than RSA or DSA (bits can only be 256, 284, or 521)
-t dsa - DEEMED INSECURE - DSA limted to 1024 bit key as specified by FIPS 186-2, No longer allowed by default in OpenSSH 7.0+
-t rsa1 - DEEMED INSECURE - has weaknesses and shouldn't be used (used in protocol 1)
-b 4096 bit size
-a 500 rounds (should be no smaller than 64, result in slower passphrase verification and increased resistance to brute-force password cracking)
-C "[email protected]" comment..
@matsest
matsest / pandoc-setup.md
Last active May 7, 2021 10:08
pandoc-latex-setup

Pandoc Setup

Description

A simple setup for Sublime to jot down notes in Markdown and compile a nice PDF with LaTeX through Pandoc conversion.

Why? Markdown is quick and easy to write, LaTeX is more of a hassle. But LaTeX produces nice PDFs. Using Pandoc, you can utilize the best features of both worlds by writing in markdown and compiling PDFs with LaTeX, with a simple one-click in your editor. This works fairly well for simple documents and pandoc supports most of Markdown syntax, in addition to supporting a range of variables set in a YAML meta block. Did I mention that it also supports writing LaTeX-style math and other LaTeX-commands in your Document? (Like this: $e^{i\pi}+1 = 0$ )

The output PDF is a A4 paper with 12pt font and 1 inch margins. It uses fancyhead to style the header and footer with date, pagenumbering and title/author. (This can be changed in your Pandoc-settings)

@srstsavage
srstsavage / nginx_google_analytics
Last active June 6, 2023 22:50
google analytics in nginx
# send logs for all traffic (including non-html) to google analytics
#
# in server block:
# set $google_analytics_id "UA-THECORRECT-ID";
# include /srv/nginx/google_analytics;
#
# in location blocks:
# post_action @ga;
#
# notes: post_action has been referred to by nginx devs as a "dirty hack" and this approach may stop working one day.
import sys
import asyncio
from aiohttp import ClientSession
async def fetch(url, session):
async with session.get(url) as response:
response = await response.read()
async def limit_fetch(sem, url, session):
async with sem: