I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# A wrapper around the Nim compiler to allow for easy scripting of Nim. Puts | |
# all temporary files in a temporary directory and cleans up after itself. | |
# | |
# Usage: | |
# - add `#!/usr/bin/env nimrun` at the beginning of your script | |
# - execute the nim file with it, for example, `nimrun file.nim args` | |
# | |
# Possible future extentions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
sudo update-alternatives --install \ | |
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-3.4 200 \ | |
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-3.4 \ | |
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.4 \ | |
--slave /usr/bin/llvm-bcanalyzer llvm-bcanalyzer /usr/bin/llvm-bcanalyzer-3.4 \ | |
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-3.4 \ | |
--slave /usr/bin/llvm-diff llvm-diff /usr/bin/llvm-diff-3.4 \ | |
--slave /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-3.4 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASH_FILE=~/.zshrc | |
mkdir -p ~/.python/src | |
cd !$ | |
wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz --no-check-certificate | |
tar xfz Python-3.4.2.tgz | |
cd Python-3.4.2 | |
mkdir $HOME/.python/python3.4 | |
./configure --prefix=!$ && make && make install | |
cd ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"0": "-----", | |
"1": ".----", | |
"2": "..---", | |
"3": "...--", | |
"4": "....-", | |
"5": ".....", | |
"6": "-....", | |
"7": "--...", | |
"8": "---..", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
set -e | |
# Save the $timeout and $timeout_style values set by /etc/grub.d/00_header | |
# before /etc/grub.d/30_os-prober messes them up. | |
cat << EOF | |
set timeout_bak=\${timeout} | |
set timeout_style_bak=\${timeout_style} | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Rewrites the request, extracting a fragment of the file name and using a remote server. | |
location @fetchFromRemote { | |
rewrite ^/path/to/images/(.*)$ http://remoteserver.com/other/path/to/images/$1 redirect; | |
} | |
#Will try to see if we have the file in this server, is not will use fetchFromRemote | |
location ~ ^/path/to/images/.*(png|jpg|jpeg|gif|ico|swf)$ { | |
try_files $uri @fetchFromRemote; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# URI of the local (caching) HTTP proxy | |
LOCAL_HTTP_PROXY = 'http://192.168.33.200:8123' | |
# Configures vagrant-cachier and vagrant-proxyconf. | |
# Should be called only on "local machine" providers. | |
def configure_caching(config) | |
if Vagrant.has_plugin?('vagrant-cachier') | |
config.cache.enable_nfs = true | |
config.cache.enable :gem | |
config.cache.enable :npm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paramiko | |
import time | |
import re | |
bastion_ip='ip' | |
bastion_pass='pass' | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() ) | |
ssh.connect(bastion_ip, username='root', password=bastion_pass) |