Skip to content

Instantly share code, notes, and snippets.

@lambdalisue
lambdalisue / csv.coffee
Created November 27, 2012 15:31
node.js CSV parser
fs = require 'fs'
removeComment = (raw) ->
return raw.replace /#.*$/, ''
trimSpace = (str) ->
return str.replace /^\s+|\s+$/g, ''
parse = (data, delimiter=',') ->
# remove comment lines
raws = (raw for raw in data.split('\n'))
@grindars
grindars / steam_bootstrap.sh
Created December 7, 2012 07:53
Steam installer for Debian
#!/bin/bash
#
# Steam installer for Debian wheezy (32- and 64-bit)
#
# Place into empty directory and run.
#
download() {
local url="$1"
local filename="$(basename "$url")"
@KartikTalwar
KartikTalwar / Documentation.md
Last active May 9, 2024 12:59
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@ymmt2005
ymmt2005 / due2fs.c
Last active June 30, 2021 05:04
Fastest du for Linux. This is in fact faster than du(1) as long as all dentries are cached :-p
/**
* Compilation:
*
* 1. Without e2fslib:
* $ gcc -O2 -o due2fs due2fs.c
*
* 2. With e2fslib
* $ sudo apt-get install e2fslibs-dev
* $ gcc -DUSE_E2FSLIB -O2 -o due2fs due2fs.c -lext2fs
*
@ryotarai
ryotarai / Hybrid.itermcolors
Last active December 18, 2015 01:09
Hybrid.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Background Color</key>
<dict>
<key>Blue Component</key>
<real>0.12941176470588237</real>
<key>Green Component</key>
<real>0.12156862745098039</real>
@yckart
yckart / README.md
Last active October 30, 2016 19:04
rawgit.com / rawgithub.com - Bookmarklet

A simple bookmarklet which makes our painful life a bit easier.

javascript:(function(b,a,c,d,e){if(/\.\w+$/.test(a))b.location=c+a.replace("/blob/","/");else if(e=prompt("Insert a filename:","index.html"))b.location=c+a.replace("/tree/","/")+(~a.indexOf(d)?"/":d)+e})(window,location.pathname,"http://rawgit.com","/master/");

The usage is quite simple:

Go to any repo where you like to preview a file, and execute the booklet. If the current url is a file, it should open the file directly, otherwise it will prompt for a filename (per default it is index.html).

@ki7chen
ki7chen / socket_with_coroutine.lua
Last active February 17, 2020 13:15
socket with coroutine
local socket = require('socket')
local threads = {}
local function receive(conn)
conn:settimeout(0)
local s, status = conn:receive(1024)
if status == 'timeout' then
coroutine.yield(conn)
end
@lambdalisue
lambdalisue / README.md
Last active October 7, 2023 12:27
Download and Compile and Install latest Vim on Debian
@lambdalisue
lambdalisue / batchprocess.py
Last active November 24, 2016 08:41
A script to enable batch processing on Gwyddion
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
#
# Author: Alisue (lambdalisue@hashnote.net)
# URL: http://hashnote.net/
# Date: 2013-07-06
#
# (C) 2013 hashnote.net, Alisue
#
import os
@lambdalisue
lambdalisue / histogram_sample.py
Last active January 12, 2016 14:49
An example code of histogram plotting (Python)
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
#
# Author: Alisue (lambdalisue@hashnote.net)
# URL: http://hashnote.net/
# Date: 2013-07-23
#
# (C) 2013 hashnote.net, Alisue
#
import math