Skip to content

Instantly share code, notes, and snippets.

View oprypin's full-sized avatar

Oleh Prypin oprypin

View GitHub Profile
#!/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:
@jc00ke
jc00ke / llvm-update-alternatives
Created November 4, 2014 02:19
LLVM & clang alternatives
#!/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 \
@vinyll
vinyll / python3.4 installer
Created October 19, 2014 09:45
Installing python3.4 at Alwaysdata
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 ~
@mohayonao
mohayonao / morse-code.json
Created July 14, 2014 06:18
morse-code.json
{
"0": "-----",
"1": ".----",
"2": "..---",
"3": "...--",
"4": "....-",
"5": ".....",
"6": "-....",
"7": "--...",
"8": "---..",
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

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!






\

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
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
@leahcim
leahcim / 25_pre-os-prober
Created March 3, 2014 19:13
In Ubuntu, /etc/grub.d/30_os-prober overrides grub menu style and timeout defined by the user in /etc/default/grub. Here is a workaround to save the menu style and timeout values before os-prober changes them, and to restore them afterwards. The two files need to be placed under /etc/grub.d and made executable. Finally, "sudo update-grub" should…
#! /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
@casivaagustin-zz
casivaagustin-zz / gist:9261586
Created February 27, 2014 23:04
nginx location rule to redirect non existing images to another server
#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;
}
@tmatilai
tmatilai / Vagrantfile
Last active January 1, 2021 19:49
My global Vagrant configuration (~/.vagrant.d/Vagrantfile)
# 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
@rtomaszewski
rtomaszewski / example_paramiko_with_tty.py
Created August 19, 2012 19:49
example paramiko script with interactive terminal
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)