Skip to content

Instantly share code, notes, and snippets.

@hafichuk
hafichuk / keybase.md
Last active August 29, 2015 14:06
keybase.md

Keybase proof

I hereby claim:

  • I am hafichuk on github.
  • I am hafichuk (https://keybase.io/hafichuk) on keybase.
  • I have a public key whose fingerprint is 7460 5068 E5C3 7534 94AB F391 5850 8624 8497 4EB1

To claim this, I am signing this object:

@hafichuk
hafichuk / gist:9895849
Created March 31, 2014 16:09
CloudFormation Tips and Trickets ;)
### Convert any standard text file to CloudFormation `Fn::Join` format
sed 's/"/\\"/g' preloaded-vars.conf | sed 's/^/"/' | sed 's/$/",/' > /tmp/preloaded-vars.conf

These suggestions are geared towards the Linux/MySQL/Apache/PHP portion of the code-o-sphere.

Source Control

There are many flavours of source control, like CVS, Perforce, SVN, git and Mercurial. I've used CVS, SVN and git, and my overall favourite is definitely git.

Free hosting of public git repositories, and a great social coding environment can be found on GitHub. I'd highly recommend contributing to some open source projects on GitHub, or creating your own projects, as it's an excellent place to point potential employers to, as they can actually see code you've written.

If you want to host private git repositories, Bitbucket allows you to host an infinite number of private repos for teams of up to 5 users.

#!/bin/bash
BACKGROUND_COLOR="black"
FONT_PATH=$HOME/.fonts/Inconsolata.otf
FONT_SIZE=70
FONT_URL="http://www.levien.com/type/myfonts/Inconsolata.otf"
WALLPAPER_SIZE="1920x1080"
WALLPAPER_PATH=$1
GITHUB_OAUTH_TOKEN_PATH=$HOME/.zen-wallpaper-oauth.token
#!/bin/bash
# Import ordered list of SQL files
files="./logs/*.sql.gz"
for f in $files
do
echo $f
echo $f >> import.log
zcat $f | mysql -uUSER -pPASS -h gloved-hand-3467.cjkao2aiaxxq.us-east-1.rds.amazonaws.com &>> import.log
<div style="color:rgb(128,128,128); font-family:Tahoma,Verdana,Helvetica,Arial,sans-serif; font-size: 12px;">
--
<br><strong style="color:rgb(0,0,0);">Brad Hafichuk</strong>
<br>Sr. Software Developer
<br>
<br>Blackline GPS | Suite 101, 1215 – 13 St SE | Calgary, AB T2G 3J4
<br>
<br>o <span style="color:rgb(0,0,0);">403 451 0327</span>
<br>e <a href="mailto:bhafichuk@blacklinegps.com" target="_blank">bhafichuk@blacklinegps.com</a>
<br>

Gists: How to merge changes from a fork

# Clone your gist
git clone git@gist.github.com:abcdef.git 
cd abcdef

# Add the fork as a remote
git remote add downstream git@gist.github.com:uvwxyz.git

# Merge in the changes from the fork
#!/bin/bash
# fail fast
set -e
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi

Chrome Web Development Extensions

  • AdBlock - The most popular Chrome extension, with over 10 million users! Blocks ads all over the web.
  • Blackline GPS JIRA/GreenHopper Tools - Tools for working with JIRA GreenHopper
  • Dev HTTP Client - Easily construct custom HTTP requests, save them permanently, take advantage of variables and contexts.
  • Edit This Cookie - Edit This Cookie is a cookie manager. You can add, delete, edit, search, protect and block cookies!
  • GitHub Notifier - Displays your GitHub notifications unread count
  • Hacker News - Displ
<?php
// devices_users.sms_control
$subject = '<control><number>1234567890</number><carrier>txt.att.net</carrier><password>foobar</password></control><control><number></number><carrier>message.alltel.com</carrier><password></password></control>';
echo $subject . "\n\n";
$pattern = ':<carrier>[a-z\.]+</carrier>:';
$replace = '';
$x = preg_replace($pattern, $replace, $subject);
echo $x . "\n\n\n";