Skip to content

Instantly share code, notes, and snippets.

@spikeekips
spikeekips / README.md
Last active August 29, 2015 14:20
`gopkgcd logging` will change the directory to that source repository.

gopkg

$ env | grep GOPATH
GOPATH=/Users/spikeekips/workspace/kasi

Installed pakcages

@spikeekips
spikeekips / convert_csv_to_json.py
Created May 18, 2015 07:52
Convert csv to json
# -*- coding: utf-8 -*-
import csv
import pprint
import json
import sys
f = sys.argv[1]
@spikeekips
spikeekips / get_scopes_of_google_apis.py
Created May 27, 2015 07:30
get or filter the scopes of google apis
import os
import requests
import json
import sys
verbose = False
arguments = list()
for i in sys.argv[1:]:
if i in ('-v'):
@spikeekips
spikeekips / json.lua
Last active August 29, 2015 14:22 — forked from jveldboom/json.lua
require "cjson"
local dt = require "date_time"
--[[
From trink in IRC - thanks!
Example use:
[HttpListenInput]
address = "0.0.0.0:8325"
@spikeekips
spikeekips / diskusage.lua
Created October 8, 2015 10:25 — forked from mattupstate/diskusage.lua
heka disk usage decoder and filter
--[[
Graphs disk usage data containing fields entield `DiskSize`, `DiskUsed`,
`DiskAvailable`, and `DiskPercentUsed`
Config:
- sec_per_row (uint, optional, default 60)
Sets the size of each bucket (resolution in seconds) in the sliding window.
- rows (uint, optional, default 1440)
Sets the size of the sliding window i.e., 1440 rows representing 60 seconds
@spikeekips
spikeekips / 0_reuse_code.js
Created October 25, 2015 16:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@spikeekips
spikeekips / gist:8dba651a1978cfd1f93b
Last active November 24, 2015 14:11
Recover after `git reset --hard`

http://stackoverflow.com/a/6780036/229734


I accidentally ran git reset --hard on my repo today too while having uncommitted changes too today. To get it back, I ran git fsck --lost-found, which wrote all unreferenced blobs to <path to repo>/.git/lost-found/. Since the files were uncommitted, I found them in the other directory within the <path to repo>/.git/lost-found/. From there, I can see the uncommitted files, copy out the blobs, and rename them.

Note: This only works if you added the files you want to save to the index (using git add .). If the files weren't in the index, they are lost.


@spikeekips
spikeekips / gist:a21582ea7035397a1650
Created March 13, 2016 04:44
open all link as a new tab
$('h3.title a').each(function() {window.open($(this).attr('href')); });
@spikeekips
spikeekips / convert-miltiple-images-to-pdf.sh
Last active April 16, 2016 07:42
Convert multiple images to pdf
# from http://xmodulo.com/convert-jpg-image-file-to-pdf-format-on-linux.html
# install ghostscript
gs -sDEVICE=pdfwrite -o output.pdf /usr/share/ghostscript/8.71/lib/viewjpeg.ps -c "(intput1.jpg) viewJPEG showpage (input2.jpg) viewJPEG showpage (intput3.jpg) viewJPEG showpage"