Skip to content

Instantly share code, notes, and snippets.

@caingougou
caingougou / default.pp
Last active December 26, 2015 20:39
puppet configuration
node devbox {
exec { "apt-get update":
user => "root",
path => [
'/bin',
'/usr/bin',
]
}
package { "vim" :
ensure => "installed",
@caingougou
caingougou / find_biggest_file.sh
Created September 11, 2013 03:17
find biggest file
find -type f -exec stat -c "%s %n" {} \;|sort -n|grep -v ".svn"
class Player
def initialize
@hero = nil
@health = 20
@danger = 10
@direction = :forward
end
def play_turn(warrior)
@hero = warrior
@caingougou
caingougou / du_sort.sh
Created July 23, 2013 16:47
list directory actual size and sort by create time
du --time -h |sort -k 2
@caingougou
caingougou / enable_mysql_general_log.sql
Created May 23, 2013 03:37
Enable mysql general log at runtime
SET GLOBAL log_output = "FILE"; which may be set by default, I think.
SET GLOBAL general_log_file = "/var/log/mysql/my.log";
SET GLOBAL general_log = 'ON';
@caingougou
caingougou / awesome_owa.js
Last active December 14, 2015 21:18
Userscript for outlook owa, add some personal settings
// ==UserScript==
// @name OWAwesome
// @namespace http://takeo.info
// @description An attempt to make OWA bearable, and maybe even awesome
// @author Toby Sterrett
// @include *us-owa.palm.com*
// ==/UserScript==
// Add jQuery
var GM_JQ = document.createElement('script');
@caingougou
caingougou / neg_look_ahead.rb
Created February 28, 2013 05:42
negative look-ahead
#!/usr/bin/env ruby
require "pp"
pattern = /^\w+(?!\.)$/
pp pattern =~ 'com.palm.system'
pp pattern =~ 'compalmsystem'
@caingougou
caingougou / casper_sample.js
Created February 20, 2013 08:57
casper sample
var casper = require('casper').create({
verbose: true,
logLevel: "debug",
pageSettings: {
localToRemoteUrlAccessEnabled : true
}
});
// casper.on('load.finished', function() {
// this.log('Page loaded', 'debug');
@caingougou
caingougou / casper_no_proxy.sh
Created February 19, 2013 09:13
Casper commandline set no proxy
casperjs casper_tester.js --proxy-type=none
@caingougou
caingougou / current_weekdays.rb
Last active December 13, 2015 22:19
Get current weekdays
#!/usr/bin/env ruby
require 'active_support/all'
Time::DATE_FORMATS[:year_month_day] = "%Y/%m/%d"
beginning_of_week = DateTime.now.beginning_of_week
end_of_week = beginning_of_week + 4.days
puts beginning_of_week.to_s(:year_month_day) + '-' + end_of_week.to_s(:year_month_day)