Skip to content

Instantly share code, notes, and snippets.

View jaredmichaelwilliams's full-sized avatar

Jared Williams jaredmichaelwilliams

View GitHub Profile
@jaredmichaelwilliams
jaredmichaelwilliams / slack.rb
Created January 14, 2015 16:53
Updated Slack notifier gem so knife-spork can alert Slack
slack.rb is located here /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-spork-1.4.2/lib/knife-spork/plugins/slack.rb
Your spork-config.yml should have this under plugins:
slack:
webhook_url: "https://hooks.slack.com/services/AAAA"
channel: "#devops"
teamname: teamname
username: knife
icon_url: http://2eof2j3oc7is20vt9q3g7tlo5xe.wpengine.netdna-cdn.com/wp-content/uploads/2013/12/chef-logo-370x275.jpg
#!/bin/bash
arp -n | awk '{print "arp -v -d "$1}' | egrep '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | bash
@jaredmichaelwilliams
jaredmichaelwilliams / Notes
Last active September 17, 2015 19:17
10 Random Words off Random Wikipedia Articles - Use for Passwords
Dependencies
brew install gnu-sed
@jaredmichaelwilliams
jaredmichaelwilliams / Extract URLs from Text
Last active September 24, 2015 17:04
Extract URLs from text.
command with text output | grep -Eo "(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?"
@jaredmichaelwilliams
jaredmichaelwilliams / elapsed-one-liner.sh
Last active October 21, 2015 02:38
Time elapsed in minutes and seconds since date on OS X - use with `watch` for updating clock
date1=$(date -j -f "%b %d %T %Z %Y" "Oct 20 21:00:00 EDT 2015" "+%s") date2=$(date +%s) diff=$(($date2-$date1)) ; echo "$(($diff / 60)) minutes and $(($diff % 60)) seconds elapsed."
@jaredmichaelwilliams
jaredmichaelwilliams / crypto-wrong-answers.md
Created November 18, 2015 16:12 — forked from paragonie-scott/crypto-wrong-answers.md
An Open Letter to Developers Everywhere (About Cryptography)

Keybase proof

I hereby claim:

  • I am jaredmichaelwilliams on github.
  • I am jaredwilliams (https://keybase.io/jaredwilliams) on keybase.
  • I have a public key ASAa4mj-mcnTOHi_vDoEmou9A9tiXeeNbrd7ax8EteqvGAo

To claim this, I am signing this object:

@jaredmichaelwilliams
jaredmichaelwilliams / tinder_like.js
Last active August 6, 2016 17:02
Use Tinder's api to like everyone in the area, over and over and over again.
STEPS
1. go to this link https://www.facebook.com/dialog/oauth?client_id=464891386855067&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=basic_info,email,public_profile,user_about_me,user_activities,user_birthday,user_education_history,user_friends,user_interests,user_likes,user_location,user_photos,user_relationship_details&response_type=token
2. AS SOON as the link loads, copy it, otherwise if you wait even one second too long, it will change because of facebooks security.
3. copy the token off the link, should be a pretty long string.
a. like this 'CAAGm0PX4ZCpsBABSh7cXCD8FC7jqhagPRBdwGZC8fLMmZCeY1dgjZBXCORBQoUN7koqGjQl3oDRZCaoZBc6FmwMBbs03p0SIL6dRW9ZCgzYGZC1qfd50vtqvzzxK3D9jMn1nkizgjMPStZAjxjxxOUNzwUYjg74Jv5QKiTEeIKsfMDvt6uOZAKsXGAGkzoBVal2ZBGhHNPZCHitJTVUNfFsZCZCQxmZBoZANH4IvYGppr0JkHCGBHgZDZD',
4. copy that into the o_token variable
5. Go to your Facebook profile, and copy the name you made or profile id, and copy that into the fb_id variable.
6. make a new folder somewhere
7. c
@jaredmichaelwilliams
jaredmichaelwilliams / Quickly Add 5GB Swap File
Last active March 24, 2018 09:03
Quick Add 5GB Swap File, and add to fstab
dd if=/dev/zero of=/mnt/swap bs=1024 count=5242880;
mkswap /mnt/swap;
chown root:root /mnt/swap ;
chmod 0600 /mnt/swap ;
swapon /mnt/swap;
echo "/mnt/swap swap swap defaults 0 0" >> /etc/fstab;
#!/bin/bash
echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; echo -e "$c\t\t- $d\n" ; done | sort -n ; echo -e "Total: \t\t$(find $(pwd) | wc -l)\n"