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
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} {
package main
import (
"crypto/md5"
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
)
func Shift(list []string) (string, []string) {
return list[0], list[1:len(list)]
}
function childFind(selector, which) {
if (!this || !this.length) return $([]);
which = (which || 'previous') + 'Sibling';
var element = this[0][which];
while (element && (element.nodeType !== 1 || !$(element).is(selector))) element = element[which];
return $(element);
@mvrilo
mvrilo / gitlab
Created October 23, 2012 17:36
gitlab init
#! /bin/bash
# GITLAB
# Maintainer: @randx
# App Version: 2.9
# from: https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab
### BEGIN INIT INFO
# Provides: gitlab
# Required-Start: $local_fs $remote_fs $network $syslog redis-server