Skip to content

Instantly share code, notes, and snippets.

View dcai's full-sized avatar
🥃
need a drink

dcai

🥃
need a drink
View GitHub Profile
@dcai
dcai / via json for libramini.json
Last active September 27, 2023 06:19
libra mini keyboard json for via
{
"name": "libra mini",
"vendorProductId": 1280134179,
"macros": ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
"layers": [
[
"LT(3,KC_TAB)",
"KC_Q",
"KC_W",
"KC_E",
@dcai
dcai / enable-vtx.bat
Created August 21, 2019 04:36
windows enable VT-x
SET UUID={0cb3b571-2f2e-4343-a879-d86a476d7215}
mountvol X: /s
bcdedit /delete %UUID%
copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
bcdedit /create %UUID% /d "DebugTool" /application osloader
bcdedit /set %UUID% path "\EFI\Microsoft\Boot\SecConfig.efi"
bcdedit /set {bootmgr} bootsequence %UUID%
bcdedit /set %UUID% loadoptions DISABLE-LSA-ISO,DISABLE-VBS
bcdedit /set %UUID% device partition=X:
mountvol X: /d
@dcai
dcai / welcome.py
Last active April 25, 2020 03:07
motd: welcome.py
#!/usr/bin/env python
import random, subprocess, socket
hostname = socket.gethostname()
animals = (
"beavis.zen",
"bong",
"bud-frogs",
"bunny",
"cheese",
@dcai
dcai / empty-tree-hash.txt
Last active August 21, 2019 04:33
git empty tree hash
4b825dc642cb6eb9a060e54bf8d69288fbee4904
@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.

@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 / 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 / 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 / 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 / apache_tune.bash
Last active November 27, 2023 15:02
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)