Skip to content

Instantly share code, notes, and snippets.

View frhd's full-sized avatar
🏠
Working from home

farhad frhd

🏠
Working from home
  • quantyc
  • Göttingen, Germany
  • 23:28 (UTC +02:00)
  • X @frhd27
View GitHub Profile
@frhd
frhd / du.sh
Created September 25, 2014 13:49
linux directory size queries
# total size of current dir
du -hs
# total size of all level 1 directories in current dir
du -h --max-depth=1 | sort -n | grep M

steps to reproduce:

curl 'http://thequeue.org/cr?id=https%3A%2F%2Faaronsw.jottit.com%2Fhowtoget&title=Aaron%20Swartz:%20howtoget' > how-to-get.html
html2text.py how-to-get.html > how-to-get.md
gist < how-to-get.md

Aaron Swartz: howtoget

'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
docpad: {
files: [ "./src/**/*.*" ],
out: ["out"]
},
watch: {
@frhd
frhd / git-uninstaller.sh
Created July 4, 2014 22:34
remove git from os x
sudo rm -rf /usr/local/git /usr/bin/git /etc/paths.d/git /etc/manpaths.d/git

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@frhd
frhd / iterateTypes.java
Created March 20, 2014 15:57
java: iterate over lists, maps
// iterate through enums
for (EnumType tt : EnumType.values()) {
System.out.println( tt.toString() );
}
// iterate through lists
List<String> list = new ArrayList<>();
for (String id : list) {
System.out.println( id );
}
@frhd
frhd / timer.cpp
Created March 5, 2014 11:25
measuring seconds with c++
#include <ctime>
void f() {
using namespace std;
clock_t begin = clock();
code_to_time();
clock_t end = clock();
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_objects import RGBColor
import argparse
import math
@frhd
frhd / pixel.html
Last active August 29, 2015 13:56
drawing pixels in css3
<div class="sprite">
</div>
@frhd
frhd / jstree 1 new node
Created February 21, 2014 15:48
jstree v1.0.0: create a new node
$("#tree-container").jstree("create", $("#new_node"), "inside", {"data":"new_node"}, false, true);