Skip to content

Instantly share code, notes, and snippets.

$ ssh -L 3305:MYSQL_CONTAINER_IP:3306 user@host
$ mysql -hlocalhost -P3305 -uroot -p
$ ffmpeg -i in.mp4 -vf select='not(mod(n\,15))',setpts=N/FRAME_RATE/TB out.mp4
for i in $(seq -f "%02g" 1 8)
do
sim-omna 201811$i /Users/shane/Downloads/201811$i
done
@ShaneQi
ShaneQi / .swiftlint.yml
Created February 27, 2019 15:17
swiftlint yml for interviewers
excluded:
- Pods
disabled_rules:
- line_length
- vertical_whitespace
- trailing_whitespace
- trailing_newline
- syntactic_sugar
- void_return
@ShaneQi
ShaneQi / pre-commit
Last active February 5, 2020 23:35
git pre-commit hook for checking author name & email
// The tutorial of setting this up:
// https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook
if [[ $(git remote) =~ "origin" ]]
then
if [[ $(git config user.name) != "Shane Qi" ]]
then
echo "Incorrect author name."
exit 1
fi
@ShaneQi
ShaneQi / unifi-controller-nginx.md
Last active November 29, 2019 15:46
Nginx config for reserve proxy unifi controller

This section needs to be in inside your HTTP context ie - HTTP { }

server {
    listen xxx.xxx.xxx.xxx:443 ssl http2;
    server_name unifi.yourdomain.com;
    ssl_certificate /etc/nginx/acme.sh/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/nginx/acme.sh/yourdomain.com/key.pem;
@ShaneQi
ShaneQi / route-vpn.sh
Last active January 3, 2020 20:31
route vpn
$ sudo route -v add -net 192.168.1.1 -netmask 255.255.255.0 -interface ppp0
@ShaneQi
ShaneQi / sort-all-files-by-size-desc.sh
Created August 20, 2020 03:14
Sort all files by size (desc).
$ find . -type f -exec du -h {} + | sort -r -h
@ShaneQi
ShaneQi / km-action-delay.sh
Created April 20, 2021 04:39
Keyboard Maestro Inter Action Delay Setting
defaults write com.stairways.keyboardmaestro.engine InterActionDelay -float 0.5
//
// InteractiveModalCardViewController.swift
// Eastwatch
//
// Created by Shane Qi on 1/14/19.
// Copyright © 2019 Shane Qi. All rights reserved.
//
import UIKit