Skip to content

Instantly share code, notes, and snippets.

@tanyuan
tanyuan / smart-caps-lock.md
Last active May 9, 2025 20:31
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 May 17, 2025 07:44
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 November 22, 2024 11:30
モヒカン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 April 28, 2025 11:10
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

@bbx10
bbx10 / ESPWebForm.ino
Created July 21, 2015 03:31
Demonstrate using an http server and an HTML form to control an LED. The http server runs on the ESP8266.
/*
* Demonstrate using an http server and an HTML form to control an LED.
* The http server runs on the ESP8266.
*
* Connect to "http://esp8266WebForm.local" or "http://<IP address>"
* to bring up an HTML form to control the LED connected GPIO#0. This works
* for the Adafruit ESP8266 HUZZAH but the LED may be on a different pin on
* other breakout boards.
*
* Imperatives to turn the LED on/off using a non-browser http client.