Skip to content

Instantly share code, notes, and snippets.

View m2sh's full-sized avatar
🤔
hmm!

Mohammad Shahgolzadeh m2sh

🤔
hmm!
View GitHub Profile
@viktorsteinwand
viktorsteinwand / Easy access to composer docker image
Last active February 17, 2016 20:56
Easy access to composer/composer docker image
# This shell script can be used for easier accessing the composer/composer docker image (https://hub.docker.com/r/composer/composer/)
Create new composer file
```sh
sudo vim /usr/local/bin/composer
```
The contents of the file will look like this:
```sh
@ShalbafZadeh
ShalbafZadeh / oreilly_downloader.py
Created October 10, 2016 16:58
Download Oreilly Free books by url
#license WTFPL
#example of usage : python oreilly_downloader.py < 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
charanpald / deeplearning.py
Created January 20, 2016 20:48
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 127.0.0.1 8118
# for unset:
# $ unsetproxy
function setproxy() {
export {http,https,ftp,HTTP,HTTPS}_proxy=http://$1:$2
export no_proxy="localhost,127.0.0.1,master.cafecluster"
echo "Proxy variable(http,https,ftp) set to $1:$2"
@amrza
amrza / private-access.java
Last active February 26, 2018 05:55
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) {
this.name = name;
}
// # 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
jprante / gist:10666960
Last active March 19, 2019 11:22
Elasticsearch configuration for high sustainable bulk feed

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

Node

@vinceallenvince
vinceallenvince / README.md
Last active April 13, 2019 05:24
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
PieterScheffers / docker-raspberry-pi.sh
Created May 30, 2017 12:49
Build ARM docker images for Raspberry Pi with QEMU
# https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/
### 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
@icambridge
icambridge / Dockerfile
Created February 4, 2017 12:33
Go dep in docker
FROM golang:1.7
# Set go bin which doesn't appear to be set already.
ENV GOBIN /go/bin
# build directories
RUN mkdir /app
RUN mkdir /go/src/app
ADD . /go/src/app
WORKDIR /go/src/app