Skip to content

Instantly share code, notes, and snippets.

View mvrilo's full-sized avatar
🌳

Murilo Santana mvrilo

🌳
View GitHub Profile
#!/usr/bin/env bash
bytesToHuman() {
b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}iB)
while ((b > 1024)); do
d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))"
b=$((b / 1024))
let s++
done
echo "$b$d ${S[$s]} of space was cleaned up :3"
@mvrilo
mvrilo / nginx.conf
Created October 15, 2016 23:06 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
#!/bin/bash
if [[ "$(uname -s)" == "Darwin" ]]; then
route get 0 | awk '/interface: /{print $NF}'
else
route | awk '/default /{print $NF}'
fi
-(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

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:

cat() {
if [ "`which pygmentize`" = "" ]; then
/bin/cat $@
return
fi
pygmentize $@ 2> /dev/null
[ $? -ne 0 ] && /bin/cat $@
}
package main
import (
"fmt"
p "github.com/kr/pretty"
)
func main() {
type myType struct {
c []byte
package main
import (
"bytes"
"compress/gzip"
"io/ioutil"
)
type File struct {
path string
package main
import "net"
// inspired by disqus.com/humans.txt
const bender = `
.-.
( )
'-'
J L
package main
import (
"sync"
"time"
)
func main() {
wg := new(sync.WaitGroup)
for _, i := range []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} {