Skip to content

Instantly share code, notes, and snippets.

View blasterpal's full-sized avatar

Hank Beaver blasterpal

View GitHub Profile
@blasterpal
blasterpal / semantic-bigquery.sql
Created April 30, 2017 18:31
BigQuery Github public data search Semantic UI
SELECT
id,
sample_repo_name,
SPLIT(content, '\n') line,
FROM
[bigquery-public-data:github_repos.sample_contents]
WHERE
(sample_path LIKE '%.html'
OR sample_path LIKE '%.json'
OR sample_path LIKE '%.js')
@blasterpal
blasterpal / fireaway.rb
Last active April 9, 2017 16:01
PoC idea for an async interface, similar to ActiveJob, but with ability add message queue features.
=begin
Problem:
HTTP is the focus of this idea. For a small team with enough on their plate already, avoiding another component or dependency into stack and ops is costly.
In this example, the cloud and PaaS services are not an option, the app lives on our hardware for business reasons. I can't use RabbitMQ as a service.
@blasterpal
blasterpal / docker-4-mac.md
Last active April 8, 2017 01:15
Docker for Mac Setup/Notes
@blasterpal
blasterpal / docker_pg_dump.sh
Last active March 21, 2017 18:01
PG Dump using Docker as client and temp volume for data.
#setup role and DB
createuser -s db_role
createdb -O db_role target_db
# use docker as your PG client
docker run -it -v /docker_data:/data postgres:9.4 bash
pg_dump --no-owner -c -O -U db_user -d source_db -h 10.0.0.1 -F t -f /data/app_qa.dump
#pull the DB dump and restore on your system
@blasterpal
blasterpal / docker_cheat_sheet.md
Last active August 4, 2016 11:25
Docker Cheat Sheet

Show log file for a container

echo $(docker inspect --format='{{.LogPath}}' 71a3d9efb7ed)
@blasterpal
blasterpal / osx_find_replace_sed.ah
Created August 19, 2015 18:40
OSX find replace w/ Sed
find . -type f -name '*.rb' -exec sed -i '' 's/rfc3339(9)/rfc3339/g' \{\} \;
@blasterpal
blasterpal / create_rabbit_queue_and_such.bash
Created August 19, 2015 16:30
Create RabbitQ queue, exchange and bind to routing key w/ Curl.
# create queue
# /api/queues/vhost/name
curl -i -u $AMQP_USER:$AMQP_PASSWORD -H "content-type:application/json" \
-XPUT -d'{"auto_delete":false,"durable":true,"arguments":[]}' \
"http://$AMQP_HOST:$RABBIT_MGT_PORT/api/queues/%2F/$SCHEDULER_TRIGGER_QUEUE"
# create exchange
# PUT /api/exchanges/vhost/name
curl -i -u $AMQP_USER:$AMQP_PASSWORD -H "content-type:application/json" \
-XPUT -d'{"type":"direct","auto_delete":false,"durable":true,"arguments":[]}' \
@blasterpal
blasterpal / add_docker_host_ip.sh
Created August 9, 2015 17:31
Adding DockerHost ip to container
$ alias hostip="ip route show 0.0.0.0/0 | grep -Eo 'via \S+' | awk '{ print \$2 }'"
$ docker run --add-host=docker:$(hostip) --rm -it debian
@blasterpal
blasterpal / old_about_me.md
Created August 6, 2015 13:08
About Me - Ver 1

About me

I have worked in almost every area of IT and software: hardware, networking, security, consulting and development. I've been called a jack-of-all trades, another has suggested 'Web Architect' since I focus on the Web. I love everything related to the internet and the open-source technologies that support it. Everyday is an opportunity to learn something new.

While I've programmed in Bash, C, Java, Node.js, PHP, Python and others on Solaris to Linux, I've had an affinity to Ruby and Ruby on Rails since 2006. My project experience varies from small micro-sites, Fortune 500 marketing sites, SaaS applications, large real estate rental sites, and social media real-time television event sites. Also before 'DevOps' became a moniker, I began working between development teams and operations, helping get large architectural changes deployed smoothly. While Ruby and Rails are my goal-to tools of choice, I am not a one-trick pony. I've written Java to talk to legacy web services when nothing else will work

@blasterpal
blasterpal / netstat_haus.sh
Created June 3, 2015 22:13
THE netstat command
netstat -nputw