Skip to content

Instantly share code, notes, and snippets.

@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@tanyuan
tanyuan / smart-caps-lock.md
Last active July 30, 2026 05:15
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

把 Caps Lock 變成智慧的 Control 以及 Escape :

  • 單獨輕按一下就是 Escape 。
  • 若按下時同時按著其他鍵,就會是 Control 。

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@ianchen06
ianchen06 / encode.py
Created February 23, 2016 02:46 — forked from derekkwok/encode.py
Simple python script to encode videos using ffmpeg
"""
This python script encodes all files that have the extension mkv in the current
working directory.
Sources:
http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide
"""
import subprocess, os
#-------------------------------------------------------------------------------
@vasanthk
vasanthk / System Design.md
Last active October 7, 2026 02:22
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@kotakanbe
kotakanbe / mohikan_slack_channels.md
Last active December 28, 2025 18:24
モヒカンslack( https://mohikan.slack.com )のチャネルリスト
@ianchen06
ianchen06 / build_nginx.md
Last active March 7, 2016 02:46
compiling-nginx-with-modules-pagespeed-and-geoip

#######Compiling nginx with pagespeed and GeoIP module

As root execute below commands

# yum install gcc-c++ pcre-devel pcre-devel zlib-devel make unzip openssl-devel

And then download PageSpeed with below commands

# mkdir -P /opt/nginx; mkdir -P /opt/nginx/modules/;
# cd /opt/nginx/modules
# NPS_VERSION=1.9.32.3
# wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
# unzip release-${NPS_VERSION}-beta.zip
@ianchen06
ianchen06 / limit-tc.sh
Last active September 22, 2018 07:02
TC limiting
#!/bin/bash
# Full path to tc binary
TC=$(which tc)
#
# NETWORK CONFIGURATION
# interface - name of your interface device
# interface_speed - speed in mbit of your $interface
# ip - IP address of your server, change this if you don't want to use
@Grokzen
Grokzen / Symmetrical ManyToMany Filter Horizontal in Django Admin.py
Last active September 4, 2024 11:27
Symmetrical ManyToMany Filter Horizontal in Django Admin
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26
# Only reposting to avoid loosing it.
"""
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin.
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction.
IMPORTANT: I have no idea for what exact versions of Django this will work for, is compatible with or was intended for.
########################################
#
# Nginx 1.8.0
# Pagespeed v.1.9.32.6
# OpenSSL 1.0.2d
# - Tested on Ubuntu 14.4.2
#
########################################
@jaydenseric
jaydenseric / ffmpeg-web-video-guide.md
Last active June 2, 2026 21:23
A quick guide to using FFmpeg to create cross-device web videos.

Video conversion with FFmpeg

Install

On mac:

  1. Download the latest release.
  2. Extract the binary and place it in /usr/local/bin.

Command basics