Skip to content

Instantly share code, notes, and snippets.

@xeonchen
xeonchen / turnoffmonitors.cpp
Created September 6, 2012 08:25
turn off monitors
#include <windows.h>
void TurnOffMonitors(BOOL bLock = FALSE)
{
::PostMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
if (bLock) ::LockWorkStation();
}
template <BOOL bLock>
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
@xeonchen
xeonchen / git-import.py
Last active January 14, 2016 10:12
import large repos to github
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
MAX_SIZE = 2000000
#!/bin/sh
DIR=${1:-gecko}
function setup() {
set -e
git init $1 && cd $1
git config fetch.prune true
# fix terminal-notifier hang issue under tmux (Mac only)
# set -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL -l"
# Set the prefix to ^A.
unbind C-b
set -g prefix C-A
bind a send-prefix
# Set status
set-option -g status-justify centre
[[ -r ~/.bashrc ]] && . ~/.bashrc
@xeonchen
xeonchen / nightly_win_updater.py
Created January 19, 2017 13:43 — forked from anonymous/nightly_win_updater.py
Update Firefox Nightly on Windows platform
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import hashlib
import os
import re
import stat
import tempfile
import urllib2