Skip to content

Instantly share code, notes, and snippets.

View martineg's full-sized avatar

Martin Eggen martineg

View GitHub Profile
@lanrat
lanrat / ns.sh
Created March 11, 2015 02:53
netstat in bash with proc
#! /bin/bash
#get all data
ROUTE=$(cat /proc/net/route | grep -v "Iface")
TCP=$(cat /proc/net/tcp | grep "[0-9]: ")
UDP=$(cat /proc/net/udp | grep "[0-9]: ")
SOCKETS=$(ls -l $(find /proc/*/fd/ -type l 2>/dev/null) 2>/dev/null | grep socket)
parse_ipv4()
@epleterte
epleterte / mygrants.sh
Created March 19, 2013 14:30
mygrants!
# cool mysql grants printing function (producing proper sql) - http://serverfault.com/a/13050
# example:
# mygrants --host=prod-db1 --user=admin --password=secret | grep rails_admin | mysql --host=staging-db1 --user=admin --password=secret
mygrants()
{
@leifg
leifg / Vagrantfile
Last active August 15, 2024 15:13
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
@phred
phred / pedantically_commented_playbook.yml
Last active June 27, 2024 13:39
Very complete Ansible playbook, showing off all the options
---
####
#### THIS IS OLD AND OUTDATED
#### LIKE, ANSIBLE 1.0 OLD.
####
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES
####
#### IF IT BREAKS I'M JUST SOME GUY WITH
#### A DOG, OK, SORRY
####
@kmarsh
kmarsh / clistat.rb
Created September 24, 2008 03:50
Really simple stats from command line output
#!/usr/bin/env ruby
#
# clistat
# Computer basic statistics from a run of curl benchmarks, it should probably be
# generalized to work from output from any cli app that gives numerical results
# one per line.
#
# Sample Usage and Output
# -----------------------------------------------------------------------------