Skip to content

Instantly share code, notes, and snippets.

View weakish's full-sized avatar

weakish weakish

View GitHub Profile
#!/usr/bin/env coffee
project = 'repo/todolist'
require 'shelljs/make'
path = require 'path'
mission = require 'mission'
mission.time()
target.folder = ->
@rkumar
rkumar / tumblr.sh
Created January 1, 2010 15:01
a command-line tumblr client using bash shell
#!/bin/bash
## vim:ts=4:sw=4:tw=100:ai:nowrap:formatoptions=croqln:
#*******************************************************#
# tumblr.sh #
# written by Rahul Kumar #
# 2010/01/01 #
# Post, edit, delete, read tumblr.com #
#*******************************************************#
# References: http://www.tumblr.com/api#api_write
# DONE : add read
@simon-lang
simon-lang / meteor-stylus-coffee.bash
Created January 24, 2013 05:38
meteor stylus coffee
If you don't have meteor, install it:
curl https://install.meteor.com | /bin/sh
Then, just copy paste this into your terminal:
meteor create my-app
cd my-app/
meteor add coffeescript
meteor add stylus
js2coffee my-app.js > my-app.coffee
@shinaisan
shinaisan / daybreak-read.rb
Created October 22, 2013 13:45
Moneta and KVS samples.
# -*- coding: utf-8-unix -*-
require 'daybreak'
include Daybreak
def show_db
db = DB.new('tmp/daybreak')
puts "Hello " + db["Hello"]
puts "It " + db["It"]
puts "See " + db["See"]
@luikore
luikore / hat-cache-miss.md
Last active May 5, 2016 15:22
Comparing cache-miss of triez, fast_trie and hash reads

To test out the cache miss behavior of read operations, run a program building the index (30k entries) then another program building then reading the index (30k queries), and find their diff.

Here's how to generate the test script cmd.sh

3.times do |i|
  %w[triez hash da].each do |ty|
    puts "valgrind --tool=cachegrind --cachegrind-out-file=tmp/#{ty} ruby t.rb #{ty}"
    puts "valgrind --tool=cachegrind --cachegrind-out-file=tmp/#{ty}.read ruby t.rb #{ty} read"
    puts "cg_diff tmp/#{ty} tmp/#{ty}.read > tmp/#{ty}#{i}.diff"
@fcicq
fcicq / filecounter.py
Last active August 13, 2017 01:27
fcicq's file counter
# fcicq's file counter, 2014.5.19, GPLv3, fcicq at fcicq dot net
import os
def calc_dir_dict(d, basedir, max_dirs=15, max_files=150, max_MBsize=128):
currdir = basedir
dir_stack = []
data = {}
d_basedir = d[basedir]
data[basedir] = [d_basedir[1], d_basedir[2], d_basedir[0]] # dirs, files, filesize
while True:
@weakish
weakish / README.md
Last active August 20, 2017 14:10
setup #centos #server #sysadmin #debian

Security is Hard

Massive Assignment

  • watch for ActiveRecord Relation, like has_many, has_many :through
  • watch for user_roles, `group_users
  • UPDATE action

Admin