Skip to content

Instantly share code, notes, and snippets.

@dukeofgaming
dukeofgaming / gist:90041eed50cbf1ec6f66
Created June 9, 2014 04:09
List all binary files' extensions under a directory
#List all binary files' extensions under a directory
find . -type f|xargs file|grep -v text|sed -r 's:.*\.(.*)\:.*:\1:g'
@dukeofgaming
dukeofgaming / gist:972288f2d997bacdc130
Created June 9, 2014 04:08
Directory Tree when there is no tree command
find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5 && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}' FS='/'
@dukeofgaming
dukeofgaming / os.capture
Created June 9, 2014 04:08
Capture console output from Lua system call
---
-- Function to retrieve console output
--
function os.capture(cmd, raw)
local handle = assert(io.popen(cmd, 'r'))
local output = assert(handle:read('*a'))
handle:close()
if raw then
@dukeofgaming
dukeofgaming / gist:e658616610b0feeb9b91
Created June 9, 2014 04:07
Deleting untracked files in git
git status --porcelain|sed -r 's:\?\?\s(.*):\1:g'|xargs rm
@dukeofgaming
dukeofgaming / gist:e7aa7f35dfc90240fa9b
Created June 9, 2014 04:07
Grant MySQL permissions to restricted host
use mysql;
grant all on *.* to user@'123.45.67.89' identified by 'password';
flush privileges;
@dukeofgaming
dukeofgaming / api_request.php
Last active August 29, 2015 14:02
Single function REST request API
<?php
set_time_limit(900);
function api_request($url, $method = null, $data = null, &$result_http_code = null){
$curl = curl_init();
if($method === null){
$method = $_SERVER['REQUEST_METHOD'];
}
@dukeofgaming
dukeofgaming / LinusTalk200705Transcript.wiki
Created March 21, 2012 17:54 — forked from lorn/LinusTalk200705Transcript.wiki
Linus google tech talk transcript

This is transcript of Tech Talk: Linus Torvalds on Git at Google on YouTube.


Andrew:

Thank you, for coming everybody, some of you probably already have heard of Linus Torvalds, those of you who haven't, you are the people with Macintoshes on your laps.