Skip to content

Instantly share code, notes, and snippets.

@dcai
dcai / iterm2.md
Created November 28, 2016 03:20
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
@dcai
dcai / load-jquery-underscore.js
Last active September 28, 2017 13:33
Load jQuery and Underscore in chrome console
(w => {
const js = w.document.createElement('script');
js.setAttribute("src", '//cdn.jsdelivr.net/g/[email protected],[email protected]');
w.document.head.appendChild(js);
return 'Loaded Javascript Libraries';
})(window);
@dcai
dcai / grid.ahk
Created February 28, 2017 02:46
autohotkey grid
; https://autohotkey.com/board/topic/72918-my-ahk-stuff/
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: windows
; Author: Andre Blanchard
;
;Windows Slide
; Script Function:
; This script allows you to move around windows by pressing the hotkey of your choice.
@dcai
dcai / Vagrantfile
Last active December 10, 2018 11:46
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 9001, host: 9001
# Create a private network, which allows host-only access to the machine
@dcai
dcai / apache_tune.bash
Last active September 3, 2024 11:49
Apache Performance Tuning Script
#!/bin/bash
# http://blog.strictly-software.com/2013/07/apache-performance-tuning-bash-script.html
echo "Calculate MaxClients by dividing biggest Apache thread by free memory"
if [ -e /etc/debian_version ]; then
APACHE="apache2"
elif [ -e /etc/redhat-release ]; then
APACHE="httpd"
fi
APACHEMEM=$(ps -aylC $APACHE |grep "$APACHE" |awk '{print $8'} |sort -n |tail -n 1)
APACHEMEM=$(expr $APACHEMEM / 1024)
@dcai
dcai / dump.js
Last active June 15, 2017 01:43
网易云音乐导出
// remember load jquery first
// https://gist.github.com/dcai/1a4675d26be0d4ccd12382ce07965157
var songs = jQuery('span.txt>a>b').map((index, value) => value.innerText);
var artists = jQuery('div.text>span[title]').map((index, value) => value.innerText);
var albums = jQuery('div.text>a').map((index, value) => value.innerText);
var results = songs.map((index, value) => ({
title: value,
artist: artists[index],
album: albums[index]
}));
@dcai
dcai / fallout4-ammo.txt
Last active September 10, 2023 06:25
fallout 4 cheat
;Ballistic
player.additem 0001f66b 1000 ;.308 round
player.additem 0004ce87 1000 ;.38 round
player.additem 0009221c 1000 ;.44 round
player.additem 0001f66a 1000 ;.45 round
player.additem 0001f279 1000 ;.50 caliber round
player.additem 0001f276 1000 ;.10mm
player.additem 0001f66c 1000 ;.5mm
player.additem 0001f278 1000 ;5.56mm
player.additem 0001f673 1000 ;Shotgun shell
@dcai
dcai / rsync-cheatsheet.bash
Last active November 6, 2017 10:17
rsync cheatsheet
SRC=/path/to/source
DEST=/path/to/dest
# Copy
rsync -aP --stats --human-readable "${SRC}" "${DEST}"
# Move
rsync -aP --stats --human-readable --remove-source-files "${SRC}" "${DEST}"
# Sync
rsync -aP --stats --human-readable --delete "${SRC}" "${DEST}"
@dcai
dcai / wbc.ahk
Last active June 26, 2019 03:43
autohotkey for westpac laptop wbc.ahk
; # => Win
; ! => Alt
; ^ => Ctrl
; + => Shift
SetCapsLockState, AlwaysOff
;; Capslock::Esc
CapsLock::Ctrl
+Capslock::Capslock
@dcai
dcai / vm-resize-hard-disk.md
Last active March 8, 2020 12:12 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Steps to resize the hard disk

  1. Stop the virtual machine using Vagrant.

     # cd vg
     # vagrant halt
    
  2. Locate the VirtuaBox VM and the HDD attached to its SATA Controller.