Skip to content

Instantly share code, notes, and snippets.

View algotrader-dotcom's full-sized avatar

Mai_Xoa algotrader-dotcom

View GitHub Profile
<?php
/*
Made by Kudusch (blog.kudusch.de, kudusch.de, @Kudusch)
---------
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
@algotrader-dotcom
algotrader-dotcom / nginx.conf
Created January 10, 2016 19:10
Rewrite URI with nginx and php-fpm. I have faced the problem that REQUEST_URI parameter is not changed on nginx rewrite rule. After some research I have found solution with replacing $request_uri variable.
server {
listen 80;
server_name site.dev;
index index.php;
root /Users/balkon_smoke/Sites/site.dev/web;
error_log /Users/balkon_smoke/Sites/site.dev/logs/error.log;
access_log /Users/balkon_smoke/Sites/site.dev/logs/access.log;
location / {
@algotrader-dotcom
algotrader-dotcom / tor_curl.php
Created January 27, 2016 04:20 — forked from zachflower/tor_curl.php
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;
@algotrader-dotcom
algotrader-dotcom / gist:d54fbcb7b47ce8e3b347
Created February 2, 2016 07:18 — forked from kitek/gist:1579117
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
@algotrader-dotcom
algotrader-dotcom / install-ffmpeg-amazon-linux.sh
Created March 4, 2016 09:04 — forked from gboudreau/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@algotrader-dotcom
algotrader-dotcom / fabfile.py
Created March 14, 2016 16:24 — forked from elliottb/fabfile.py
Example Python Fabric deployment script. Deploys code from a deployment box to a remote host. Usage from command line on the deployment box: fab deploy.
from fabric.api import local, run, env, put
import os, time
# remote ssh credentials
env.hosts = ['10.1.1.25']
env.user = 'deploy'
env.password = 'XXXXXXXX' #ssh password for user
# or, specify path to server public key here:
# env.key_filename = ''
@algotrader-dotcom
algotrader-dotcom / notes.md
Created March 15, 2016 03:18 — forked from DavidWittman/notes.md
A Brief Introduction to Fabric

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

@algotrader-dotcom
algotrader-dotcom / basic_iptables.sh
Created May 24, 2016 08:15 — forked from deangerber/basic_iptables.sh
Simple iptables firewall setup script.
#! /bin/bash
iptables -F
iptables -X
echo Allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
echo Allow http and https
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
echo Allow pop, imap and smtp
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
@algotrader-dotcom
algotrader-dotcom / server.conf
Created June 14, 2016 07:37 — forked from laurenorsini/server.conf
OpenVPN configuration for /etc/openvpn/server.conf
local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here!
server 10.8.0.0 255.255.255.0
# server and remote endpoints
@algotrader-dotcom
algotrader-dotcom / Script to Install JAVA 8
Last active June 20, 2016 03:48 — forked from manishval/gist:28b57a6872b2d5b968a0
Script to Install JAVA 8 (JDK 8u40) on CentOS/RHEL 7/6/5 and Fedora
#!/bin/bash
# Script to Install JAVA 8 (JDK 8u40) on CentOS/RHEL 7/6/5 and Fedora
# http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/
# Requirements: $yum install wget -y
echo "Installing Java 8 (64bit)"
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-x64.tar.gz"