Skip to content

Instantly share code, notes, and snippets.

View AvnerCohen's full-sized avatar
🌍
Working from home

Avner Cohen AvnerCohen

🌍
Working from home
View GitHub Profile
BEFORE:
sam@ubuntu discourse % rm -fr tmp/cache
sam@ubuntu discourse % rm -fr public/assets
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile
58.55s user 1.79s system 100% cpu 1:00.02 total
AFTER:
@Jesus
Jesus / deploy.rb
Last active June 2, 2016 23:31 — forked from buntine/deploy.rb
# Clear existing task so we can replace it rather than "add" to it.
Rake::Task["deploy:compile_assets"].clear
desc "Precompile assets locally and then rsync to web servers"
task :compile_assets do
# compile assets locally
run_locally do
with rails_env: fetch(:stage) do
execute :bundle, "exec rake assets:precompile"
end
@remy
remy / deploy.sh
Created April 2, 2015 16:06
JS Bin's deploy script, run using `deploy jsbin/jsbin` (though the argument should probably just be hard coded since jsbin appears in the source)
#!/bin/bash
readonly ARGS="$@"
readonly DEPLOY_USER="www-data"
clone_repo_at_tag() {
local repo="$1"
local tag="$2"
local project_name="$3"
local repo_dirname="$project_name-$tag"
@colinsurprenant
colinsurprenant / ec2_openvpn_setup.md
Last active July 25, 2017 15:35
EC2 and OSX OpenVPN setup

EC2/Ubuntu OpenVPN server config

  • open UDP port 1194 using EC2 security groups
sudo apt-get install openvpn
sudo openvpn —genkey —secret /etc/openvpn/openvpn-key.txt
sudo modprobe iptable_nat
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -s 10.8.0.1/2 -o eth0 -j MASQUERADE
@kwilczynski
kwilczynski / vpn.sh
Last active February 12, 2018 19:54
OpenVPN for TCP and UDP for use with EC2 user data.
#!/bin/bash
set -e
set -u
set -o pipefail
# Return netmask for a given network and CIDR.
cidr_to_netmask() {
value=$(( 0xffffffff ^ ((1 << (32 - $1)) - 1) ))
echo "$(( (value >> 24) & 0xff )).$(( (value >> 16) & 0xff )).$(( (value >> 8) & 0xff )).$(( value & 0xff ))"
@rantav
rantav / call for moderators.md
Last active March 29, 2018 06:30
Reversim Summit 2018 is looking for moderators

Dear all, we’re starting to work on Reversim Summit 2018, which will take place Oct 8-9 in University of Tel Aviv. We’re gathering the moderation team led by Shlomi Noach (the content Tzar) and are about to open the CFP soon. Reversim Summit is a community effort and as such we tentatively* invite you to join our team of moderators.

Please email us at rs18-team@googlegroups.com to state your interest and provide credentials (e.g professional background, speaking and moderation experience)

If you’re interested then please let us know within a week from today.

High level timeline:

@thoolihan
thoolihan / install_tensorflow_centos7.sh
Last active January 28, 2019 06:17
Install TensorFlow on CentOS7
sudo yum -y install epel-release
sudo yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel
# use pip or pip3 as you prefer for python or python3
pip install --upgrade virtualenv
virtualenv --system-site-packages ~/venvs/tensorflow
source ~/venvs/tensorflow/bin/activate
pip install --upgrade numpy scipy wheel cryptography #optional
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
# or below if you want gpu, support, but cuda and cudnn are required, see docs for more install instructions
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
@look4regev
look4regev / basic_mac_setup.sh
Last active July 31, 2019 14:47
Installs basic dev tools for MacOS
#!/bin/bash
echo "Installing brew (MacOS package manager)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Installing needed tools for development"
brew install gcc asdf coreutils gpg zlib mongodb rabbitmq yarn libxmlsec1 git cask zsh pkg-config readline openssl
echo "Install python and node with asdf"
source /usr/local/opt/asdf/asdf.sh
@antonio
antonio / delete_branches_older_than.sh
Created January 21, 2013 14:29
Script to delete branches older than a certain date
#!/bin/sh
date=$1
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
if [[ "$(git log $branch --since $date | wc -l)" -eq 0 ]]; then
if [[ "$branch" =~ "origin/" ]]; then
local_branch_name=$(echo "$branch" | sed 's/^origin\///')
if [[ "$DRY_RUN" -eq 1 ]]; then
echo "git push origin :$local_branch_name"
@alexbevi
alexbevi / pre-commit.sh
Created August 23, 2012 12:05
Git pre-commit hook that checks ruby source files for Pry breakpoints
# Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files
# for Pry binding references
#
# Installation
#
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit
#
# Based on
#
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/