Skip to content

Instantly share code, notes, and snippets.

@georgeOsdDev
georgeOsdDev / vmstat_date.pl
Created August 21, 2012 10:55
show time on vmstat
#!/usr/bin/env perl
use POSIX 'strftime';
while(<>){
print strftime('%Y/%m/%d %H:%M:%S',localtime) , $_ ;
}
#usage
#vmstat -5 | perl vmstat_date.pl
@georgeOsdDev
georgeOsdDev / index.html
Created August 23, 2012 01:59
FizzBuzz
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>$title</title>
$styles
</head>
<body>
<h1>$title</h1>
@georgeOsdDev
georgeOsdDev / gist:3788257
Created September 26, 2012 14:06
df as json by oneliner
df -k --portability | sed -e "s/\s\{1,\}/,/g" | awk 'BEGIN{FS=",";json = "[{"}{if (NR == 1) { for (i=1;i < NF+1;i++) { key[i] = $i}};if(NR != 1){for (i=1;i < NF;i++) { json = json "\"" key[i] "\":\"" $i "\","}; json = json "\"" key[NF] "\":\"" $NF "\"},{" }} END{ sub(/,\{$/, "", json);json = json "]";print json}' >> df.json
@georgeOsdDev
georgeOsdDev / main.js
Created October 6, 2012 03:53
get coderwall badge
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="coderwallbadges" class="badge" data-source="georgeosddev"></div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
@georgeOsdDev
georgeOsdDev / jquery.switchClass.coffee
Created January 1, 2013 14:25
jquery.switchClass snippet
(($) ->
$.fn.switchClass = (from, to="") ->
$(@).removeClass(from).addClass(to)
$(@)
) jQuery
@georgeOsdDev
georgeOsdDev / Default (OSX).sublime-keymap
Created January 12, 2013 08:23
Sublime Text 2 Setting
[
{ "keys": ["ctrl+t"], "command": "side_bar_new_file2" }
,{ "keys": ["f2"], "command": "side_bar_rename" }
,{ "keys": ["ctrl+alt+f"], "command": "side_bar_find_files_path_containing" }
]
@georgeOsdDev
georgeOsdDev / gist:4642043
Created January 26, 2013 12:27
classっぽく書くときのメモ
(function(global){
"use strict";
var _App,version,name;
_App = (function(){
function _App(){
version = "0.0.1";
name = "SAMPLE";
}
_App.prototype.getVersion = function(){
return version;
@georgeOsdDev
georgeOsdDev / gist:4655626
Last active December 11, 2015 20:28
メモ化でフィボナッチ数列
cache = []
fib = (i) ->
_fib = (i) ->
if i is 0 or i is 1 then return i
if cache[i]?
return cache[i]
else
cache[i] = _fib(i-1) + _fib(i-2)
_fib(i)
@georgeOsdDev
georgeOsdDev / index.html
Last active December 13, 2015 21:08
JSONPでデータ取得
<html>
<head>
<meta charset="utf-8">
<meta name=description content="JSONP SAMPLE">
<meta name=viewport content="width=device-width, initial-scale=1">
<title>JSONP</title>
</head>
<body>
<h2>JSONP Sample</h2>
<script src="./jsonp_client.js" type="text/javascript" charset="utf-8"></script>
@georgeOsdDev
georgeOsdDev / a_1.js
Last active December 14, 2015 03:39
Gengo Challenges
var calc;
calc = function(numStr){
var left,right,sumLeft,sumRight;
if (typeof numStr !== "string" || isNaN(Number(numStr))){
throw new TypeError("unexpected argument");
}
if (numStr.length%2 !== 0){
throw new Error("argument must be 2*N digits");
}
left = numStr.substr(0,numStr.length/2);