Skip to content

Instantly share code, notes, and snippets.

View mvrilo's full-sized avatar
🌳

Murilo Santana mvrilo

🌳
View GitHub Profile
cat() {
if [ "`which pygmentize`" = "" ]; then
/bin/cat $@
return
fi
pygmentize $@ 2> /dev/null
[ $? -ne 0 ] && /bin/cat $@
}

Keybase proof

I hereby claim:

  • I am mvrilo on github.
  • I am murilo (https://keybase.io/murilo) on keybase.
  • I have a public key whose fingerprint is 0A03 A6A8 DF50 F4E8 2344 0394 3C84 58DE 0ABD AE4E

To claim this, I am signing this object:

-(void)setAmbient:(id)args
{
NSError* error = nil;
BOOL success = [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: &error];
if (!error || !success) {
DebugLog(@"Could not set category");
}
}
-(void)setAmbientDuckOthers:(id)args
#!/bin/bash
if [[ "$(uname -s)" == "Darwin" ]]; then
route get 0 | awk '/interface: /{print $NF}'
else
route | awk '/default /{print $NF}'
fi
@mvrilo
mvrilo / ggl.sh
Created March 28, 2010 00:27
Google url shortener bash script
#!/bin/bash
# Author: Murilo Santana
# Google url shortener bash script
# For information about the url shortener app:
# http://ggl-shortener.appspot.com/instructions/
app='http://ggl-shortener.appspot.com/?url='
url="$1"
protocol=`echo "$1" | sed -e "/^http:\/\//g"`
# node.js app under nginx
upstream node {
server 127.0.0.1:8001;
}
server {
listen 80;
server_name node;
// setTimeout Looping
function loop(fn,time){
setTimeout(fn(),time);
loop(fn(),time);
}
#!/usr/bin/env node
console.log("output string 'test' encrypted");
var crypto = require('crypto');
function md5(str) {
var hash = crypto.createHash('md5');
hash = hash.update(str);
hash = hash.digest('hex');
var buffer = require('buffer').Buffer;
function base64(str) {
new buffer(str).toString('base64');
}
# simple example with Sinatra
require 'rubygems'
require 'sinatra'
class Example
get '/' do
haml :index
end
end