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 / .vimrc
Last active April 26, 2024 02:25
minimal .vimrc, old backup here: https://gist.github.com/dcai/2d51a2ef453efa24d1b0
"""""""""""""""""""""""""""""""""""""""
" __ _ "
" ____/ /________ _(_) "
" / __ / ___/ __ `/ / "
" / /_/ / /__/ /_/ / / "
" \__,_/\___/\__,_/_/ "
" "
" Dongsheng Cai <d@tux.im> "
" "
"""""""""""""""""""""""""""""""""""""""
@dcai
dcai / .editorconfig
Last active April 26, 2024 02:25
git config gitconfig
root = true
[*]
indent_style = tab
@dcai
dcai / tmux.conf-2.x
Last active April 26, 2024 02:25
tmux config
# Author: Dongsheng Cai
#
# Gist: https://gist.github.com/dcai/3824286
#
# c-d to close shell
# <prefix> s to switch to another session
# <prefix> f to find a window
# <prefix> o to switch to another panel
# <prefix> ! to close other panes except current one
# <prefix> x Kill the current pane
@dcai
dcai / gist:1274526
Last active March 25, 2024 07:39
Resize image
We couldn’t find that file to show.
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
@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)
@dcai
dcai / index.md
Last active October 14, 2023 09:07
gist index
@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 / 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 / cvs-moodle.bash
Last active September 10, 2023 03:51
cvs helper for moodle repository
ct (){
if [ $# -eq 0 ]; then
echo "CVS TAG: No arguments entered.";
return 1
else
echo "Tagging [MOODLE_$1_MERGED]";
echo "File(s) ${@:2}";
echo "Tagging ...";
cvs tag -RF MOODLE_$1_MERGED ${@:2}