Skip to content

Instantly share code, notes, and snippets.

Over the past several years, the stream of Canadians moving to the United States has become a flood. The numbers increase faster than statistics can keep up with, for several reasons. The need for IT professionals south of the border shows no signs of slowing down, and, thanks to NAFTA, it's easier than ever for Canadians to obtain a US work permit.
So you've found your ideal job, packed your belongings, and arrived at the border with your documents. How long can you stay in the best country on earth? Well, that 150-dollar Employment Authorization may only buy you a one-year maximum, but don't panic - extensions may be granted in one-year increments. Extensions can be applied for through the mail with no fuss or worry. There is no set time limit on how long you can remain in Canada as a professional, so you can apply for extensions yearly and eventually apply for permanent residency. You will know that you truly belong here when you refer to the winter weather in Minnesota as "balmy"
@gamesguru
gamesguru / khaled-amazon-reading-book-chapters.cpp
Last active April 16, 2024 01:39
Solution to reading a book of chapters within given number of days
#include <bits/stdc++.h>
using namespace std;
int solution(vector<int> arr, int days_til_exam) {
// number of chapters
int n_chaps = arr.size();
// longest chapter
int m = *max_element(arr.begin(), arr.end());
@gamesguru
gamesguru / rsync.sh
Last active April 7, 2022 02:49
Shell script for neatly dry running and archiving rsync src and dest media
#!/bin/bash
cd "$(dirname "$0")"
rsync_cmd="rsync --archive --verbose"
# Determine if `--dry-run`
real=0
for var in "$@"
@gamesguru
gamesguru / .screenrc
Created March 17, 2022 18:15
From Chris
defshell -bash
hardstatus alwayslastline
hardstatus string '%{= kw}%-w%{= BW}%50>%n %t%{= kw}%+w%<'
shelltitle ""
multiuser off
vbell_msg "Beep!"
startup_message off
defscrollback 40000
#terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
@gamesguru
gamesguru / .vimrc
Created March 5, 2021 19:56
vim config
syntax on
@gamesguru
gamesguru / .bash_profile
Created March 5, 2021 19:53
bash profile (macOS)
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
[[ -r "/usr/local/etc/bash_completion.d/python-argcomplete" ]] && . "/usr/local/etc/bash_completion.d/python-argcomplete"
_ssh()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
@gamesguru
gamesguru / .zprofile
Created March 5, 2021 19:52
zsh profile
# autoload -Uz compinit
# compinit
# [[ -r "/usr/local/etc/bash_completion.d/python-argcomplete" ]] && . "/usr/local/etc/bash_completion.d/python-argcomplete"
# eval "$(register-python-argcomplete /Users/shane/nutra/cli/nutra)"
alias grep='ggrep --color'
export GPG_TTY=$(tty)
@gamesguru
gamesguru / .zshrc
Created March 5, 2021 17:28
zsh rc file
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/shane/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@gamesguru
gamesguru / sol.py
Created January 15, 2021 18:19
Python printing: family-tree
class Node:
def __init__(self, parent_id, id, name):
self.id = id
self.parent_id = parent_id
self.name = name
self.children = []
def printChildren(node, level=1):
for c in node.children: