Skip to content

Instantly share code, notes, and snippets.

😅
what's up?

Mendelson Gusmão mendelgusmao

😅
what's up?
Block or report user

Report or block mendelgusmao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fan.sh
minSpeed=1500
maxSpeed=5500
highTemp=70
normalTemp=40
output=/sys/devices/platform/applesmc.768/fan1_output
manual=/sys/devices/platform/applesmc.768/fan1_manual
currentSpeed=$(cat $output)
View vwash.sh
cache=/var/db/vwash.cache
touch $cache
while read line; do
mac=$(echo "$line" | cut -d: -f1-3)
if echo $mac | grep -i -e '[a-f0-9]\{2\}:' > /dev/null; then
lookup=$(grep "$mac=" $cache)
if [ $? -gt 0 ]; then
@mendelgusmao
mendelgusmao / main.go
Last active Aug 29, 2015
how many valid CPFs are there?
View main.go
package main
import (
"fmt"
"runtime"
)
type CPF []int
func NewCPF(cpf int64) CPF {
@mendelgusmao
mendelgusmao / main.go
Last active Dec 16, 2018
.zsh_history merge+remove duplicate lines
View main.go
package main
import (
"fmt"
"io/ioutil"
"os"
"regexp"
"sort"
"strconv"
"strings"
View nginx+socks.patch
diff -rupN nginx-1.6.2/auto/modules nginx-1.6.2-socks-upstream/auto/modules
--- nginx-1.6.2/auto/modules 2014-09-16 09:23:19.000000000 -0300
+++ nginx-1.6.2-socks-upstream/auto/modules 2014-10-29 19:28:26.451597644 -0200
@@ -381,6 +381,11 @@ if [ $HTTP_UPSTREAM_LEAST_CONN = YES ];
HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_LEAST_CONN_SRCS"
fi
+if [ $HTTP_UPSTREAM_SOCKS = YES ]; then
+ have=NGX_HTTP_UPSTREAM_SOCKS . auto/have
+ HTTP_SRCS="$HTTP_SRCS src/http/modules/ngx_http_upstream_socks_module.c"
View snake-os-qemu.sh
#********************************************************************
# WARNING:: This whole exercise is performed while logged in as root.
# FOLLOW AT YOUR OWN RISK
#********************************************************************
# Setup a working directory anywhere you like. I'm using /vb/snakex.
mkdir /vb/snakex
cd /vb/snakex
export MYTOP=`pwd`
View shared_struct_test.go
package xml
import (
"testing"
)
var (
fooXML = `
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root xmlns="urn:ietf:params:xml:ns:root-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:root-1.0 root-1.0.xsd">
@mendelgusmao
mendelgusmao / gist:6076361
Last active Dec 20, 2015
updates /etc/hosts whenever a host ip changes useful for creating host aliases usage: update-hosts <host_alias> <host_ip>
View gist:6076361
hosts=/etc/hosts
host=$1
ip=$2
if [ "$ip" = "" ]; then
ip=$(wget -qO- http://checkip.dyndns.org | cut -f2 -d":" | cut -f1 -d"<" | sed "s/ //")
fi
line=$(grep $host $hosts)
@mendelgusmao
mendelgusmao / gist:5823291
Last active Jul 13, 2019
BTSync / BitTorrent Sync behind nginx
View gist:5823291
# take one
# subdirectory (one server, multiple services)
location /btsync/ {
rewrite ^/btsync/gui(.*) /btsync$1 last;
proxy_pass http://127.0.0.1:8888/gui/;
proxy_redirect /gui/ /btsync/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
View chinelada.no.rasmus.php
<?php
// ...
$sets = array_map(
function($set) {
return explode(",", end(explode(": ", $set)));
},
array_filter(
explode("\n", file_get_contents($url)),
You can’t perform that action at this time.