Skip to content

Instantly share code, notes, and snippets.


Mohammad Shahgolzadeh m2sh

View GitHub Profile
viktorsteinwand / Easy access to composer docker image
Last active Feb 17, 2016
Easy access to composer/composer docker image
View Easy access to composer docker image
# This shell script can be used for easier accessing the composer/composer docker image (
Create new composer file
sudo vim /usr/local/bin/composer
The contents of the file will look like this:
ShalbafZadeh /
Created Oct 10, 2016
Download Oreilly Free books by url
#license WTFPL
#example of usage : python < url_list
#url_list should contain list of urls , a url per line
import sys
import urllib2
from urllib2 import URLError
#making url ready fo download
def reformat_url(url):
charanpald /
Created Jan 20, 2016
An example of deep learning on the digits dataset using Keras
import numpy
import pandas
from sklearn.datasets import load_digits
from sklearn import preprocessing
from sklearn.cross_validation import KFold
from sklearn.svm import SVC
from sklearn.metrics import zero_one_loss
from keras.models import Sequential
from keras.layers.core import Dense, Activation
# using:
# for set proxy:
# $ setproxy 8118
# for unset:
# $ unsetproxy
function setproxy() {
export {http,https,ftp,HTTP,HTTPS}_proxy=http://$1:$2
export no_proxy="localhost,,master.cafecluster"
echo "Proxy variable(http,https,ftp) set to $1:$2"
amrza /
Last active Feb 26, 2018
Objects of the same type will have access to each others private and protected members even though they are not the same instances! WTF!
// Person.class
class Person {
private String name;
public Person(String name) { = name;
View SnappTotalPriceCalculator.js
// # Usage
// Save this file and replace username and password on the last line of the file with
// your Snapp username and password then run the following commands:
// yarn init && yarn add request
// node SnappTotalPriceCalculator.js
const request = require('request');
jprante / gist:10666960
Last active Mar 19, 2019
Elasticsearch configuration for high sustainable bulk feed
View gist:10666960

Elasticsearch configuration for high sustainable bulk feed

Test on single node, MacBook Pro, 16 GB RAM, 1TB SSD, OS X Maverick

ES 1.1.0 with Java 8, G1 GC, 12 GB heap

/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -Xms12g -Xmx12g -Djava.awt.headless=true -XX:+UseG1GC -Delasticsearch -Des.foreground=yes -Des.path.home=/Users/es/elasticsearch-1.1.0 -cp :/Users/es/elasticsearch-1.1.0/lib/elasticsearch-1.1.0.jar:/Users/es/elasticsearch-1.1.0/lib/:/Users/es/elasticsearch-1.1.0/lib/sigar/ org.elasticsearch.bootstrap.Elasticsearch


vinceallenvince /
Last active Apr 13, 2019
CI with Travis, github Releases API, gh-pages and npm publish

CI with Travis, GitHub Releases API and gh-pages

When hosting a project on GitHub, it's likely you'll want to use GitHub Pages to host a public web site with examples, instructions, etc. If you're not using a continuous integration service like Travis, keeping your gh-pages site up to date requires continuous wrangling.

The steps below outline how to use Travis CI with GitHub Releases and GitHub Pages to create a "1-button" deployment workflow. After testing and running a release build, Travis will upload your release assets to GitHub. It will also push a new version of your public facing site to GitHub Pages.

Organize your project

Let's assume you are hosting a JavaScript project that will offer a single JavaScript file as a release asset. It's likely you'll organize your files like this.

PieterScheffers /
Created May 30, 2017
Build ARM docker images for Raspberry Pi with QEMU
### Choose a base image with QEMU binary
# FROM hypriot/rpi-alpine
# FROM resin/rpi-raspbian
# FROM resin/raspberry-pi-alpine-node:slim
### Register QEMU in the build agent
docker run --rm --privileged multiarch/qemu-user-static:register --reset
Thermionix / auth-basic.conf
Last active Jul 3, 2019
nginx reverse proxy for sickbeard, couchpotato etc.
View auth-basic.conf
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;