Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@itsPG
itsPG / pcre.cpp
Last active August 29, 2015 14:07
#define OVECCOUNT 30 /* should be a multiple of 3 */
#define EBUFLEN 128
#define BUFLEN 1024
int main()
{
pcre *re;
const char *error;
int erroffset;
int ovector[OVECCOUNT];
@itsPG
itsPG / _orihime_dmhy_download_v2_prototype.js
Last active August 29, 2015 14:14
_orihime_dmhy_download_v2_prototype.js
var dump = require('utils').dump;
var und = require('underscore');
var fs = require('fs');
var g_task_list = [];
var g_dmhy_url = 'http://share.dmhy.org';
var g_persistent_time = 10000; // main thread will wait XXX ms
function call_cb(callback, scope, args) {
if (typeof(callback) === 'function') {
callback.apply(scope || window, args);
@itsPG
itsPG / gitconfig
Created April 20, 2015 12:35
gitconfig
[user]
name = PG
email = smartPG@gmail.com
[core]
editor = vim
[alias]
st = status
ci = commit
co = checkout
br = branch
@itsPG
itsPG / sublime
Created April 20, 2015 12:39
sublime
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"default_line_ending": "unix",
"font_face": "monaco",
"font_size": 12,
"ignored_packages":
[
"Vintage"
],
"trim_trailing_white_space_on_save": true
@itsPG
itsPG / git_config.sh
Last active September 12, 2022 01:36
git config
# User
git config --global user.name YOUR_NAME
git config --global user.email YOUR_EMAIL@gmail.com
git config --global core.editor vim
# Common
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
@itsPG
itsPG / casperjs-on-docker-note.txt
Last active August 29, 2015 14:23
install casperjs on Docker - Ubuntu
apt-get install nodejs
apt-get install npm
cd /usr/bin
ln -s nodejs node
npm install -g phantomjs
npm install -g casperjs
apt-get install libfreetype6-dev
apt-get install libfontconfig
/* Assuming:
* dataview is a { xtype: "list" }
* dataview.itemTpl includes a <div class="deleteplaceholder"></div>
*
* Delete button will disappear as soon as something is touched
*/
dataview.on("itemswipe", function(dataview, ix, target, record, event, options) {
if (event.direction == "left") {
var del = Ext.create("Ext.Button", {
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@itsPG
itsPG / vnc.md
Last active November 12, 2015 01:56
Setup vncserver on ubuntu 14.04.3

Tested on Ubuntu 14.04.3 (2015/11/11)

install gnone related packages

apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

install vnc server

apt-get install vnc4serve

start & stop vncserver to generate config