Skip to content

Instantly share code, notes, and snippets.

View andresvia's full-sized avatar
💭
adsking

Andres Villarroel andresvia

💭
adsking
View GitHub Profile
@andresvia
andresvia / getpsoverh.py
Last active January 4, 2016 17:59
solaris process memory overhead with pmap python wrapper for all processes
#!/usr/bin/env python
# this is only for Solaris
# just when i think I have understanded solaris memory usage
# I get prstat outputs which sum more than 100% on memory usage
# this is apparently a memory overhead caused by sharing of memory between procs.
# this program gives a list of proceses
# rss memory and not shared mememory
@andresvia
andresvia / update_arch.sh
Created February 3, 2014 14:30
My Arch Linux update routine
#!/bin/bash
COMMANDS_TEMP="$(mktemp)"
COMMANDS="$(mktemp)"
cat > "$COMMANDS_TEMP" << 'EOF'
df -h
links https://www.archlinux.org/news/
sudo pacman -Syu
pacman -Qi | egrep '^Name[[:space:]]*:|^Packager[[:space:]]*:[[:space:]]*Unknown Packager' | grep -B1 '^Packager' | grep '^Name' | cut -d':' -f2 | xargs pacman -Q
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) (z float64) {
s := 1.0
min_change := 0.01
var range = function(start, end, mult){
if (end == undefined) {
end = start;
if (end < 0) {
start = end;
end = -1;
} else if (end > 0) start = 1;
else start = 0;
}
if (mult == undefined) mult = 1;
var reverseArray = function(a) {
var r = []
for(var i = a.length-1; i>=0 ; i--) {
r.push(a[i])
}
return r
}
var prepend = function (v, l) {
return {value:v, rest:l}
}
var deepEqual = function(o1, o2) {
if (typeof(o1) == "object" &&
typeof(o2) == "object" &&
o1 != null &&
o2 != null) {
for(var p1 in o1) {
if (!deepEqual(o1[p1], o2[p1])) return false
}
for(var p2 in o2) {
if (!deepEqual(o1[p2], o2[p2])) return false
#!/bin/bash -eu
eval "$(ssh-agent -s)"
trap "ssh-agent -k" EXIT
pushd /var/www/montogeek/laravel/docs
git submodule update --remote --merge
popd
#!/bin/bash -e
my_vars="MYSQL_SERVER MYSQL_DATABASE MYSQL_USER MYSQL_PASSWORD EXTERNAL_ENV"
for var in ${my_vars}
do
if [ -z "${!var}" ]
then
echo "No ${var} defined"
exit 1
fi
val="${!var}"
@andresvia
andresvia / sec
Last active September 5, 2015 20:23
Defaults for sec
polgara:~# cat /etc/default/sec
#Defaults for sec
RUN_DAEMON="yes"
DAEMON_ARGS="-conf=/etc/sec.conf -input=/var/log/syslog -pid=/var/run/sec.pid -detach -log=/var/log/sec.log"
polgara:~# cat /etc/sec.conf
# http://simple-evcorr.sourceforge.net/man.html
# http://sixshooter.v6.thrupoint.net/SEC-examples/article.html
# http://sixshooter.v6.thrupoint.net/SEC-examples/article-part2.html
#!/usr/bin/env python
import requests
import os
auth = ''
def login():
global auth
r = requests.post(os.getenv('ZABBIX_URL') + '/api_jsonrpc.php', json = {