Skip to content

Instantly share code, notes, and snippets.

View cb0's full-sized avatar

Marcus Puchalla cb0

View GitHub Profile
@cb0
cb0 / keybase.md
Created February 23, 2017 17:17
keybase.md

Keybase proof

I hereby claim:

  • I am cb0 on github.
  • I am cb0 (https://keybase.io/cb0) on keybase.
  • I have a public key whose fingerprint is 9FAD 9F16 6F87 71C3 42C6 DE38 6B8C 0D2A 4435 7A9C

To claim this, I am signing this object:

@cb0
cb0 / wefewf
Created October 10, 2016 10:38
vagrant helper script
#vagrant helper functions for brining up and shutting down the machines
#deps: - vagrant (of course)
- jq - Command-line JSON processor
- fzf - command-line fuzzy finder
#`vagrant_list` as helper function to get a list of all machines
vagrant_list () {
tmp=$(cat ~/.vagrant.d/data/machine-index/index | jq '.machines[] | {name, vagrantfile_path, state}' | jq '.name + "," + .state + "," + .vagrantfile_path'| sed 's/^"\(.*\)"$/\1/'| column -s, -t | sort -rk 2 | fzf )
echo $tmp | awk '{ print $1 }'
}
@cb0
cb0 / gist:54af5d469ce733e21481
Created August 17, 2015 08:36
Make linux command un(s)traceable
#block other user from using [s|p]trace on your code
> ./somecommand &
> sudo strace $(echo $!) > /dev/null &
Now another user cannot strace the proess.
One would need to stop and restart the process which could easily be detected with other methods.
@cb0
cb0 / qweifhiqwh
Created February 23, 2015 09:36
SSH Alias Bug
##AUTHOR: M. Puchalla
##SHORT DESC: possible non-critical ssh bug that is related to ssh alias (~/.config) file.
##FULL DESCRIPTION:
1. Connect to host where host key is not know.
e.g. ssh test.localhost #(redirects to vagrant machine)
2. Answer first question with "yes", enter new password, connect to host
@cb0
cb0 / weiofjoqwjf
Created January 14, 2015 14:31
Get all contributors for a git controlled file.
git log --no-notes --pretty=format:"%an %ae" --follow FILENAME
@cb0
cb0 / Vagrantfile_example
Last active August 29, 2015 14:13
Vagrant Config Performance (full cpu, 1/4 memory)
#taken from https://stefanwrobel.com/how-to-make-vagrant-performance-not-suck
config.vm.provider "virtualbox" do |v|
host = RbConfig::CONFIG['host_os']
# Give VM 1/4 system memory & access to all cpu cores on the host
if host =~ /darwin/
cpus = `sysctl -n hw.ncpu`.to_i
# sysctl returns Bytes and we need to convert to MB
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4