Skip to content

Instantly share code, notes, and snippets.

View scarsman's full-sized avatar

Perpo Hipolito scarsman

View GitHub Profile
http {
proxy_cache_path /tmp/nginx/cache
levels=1:2
keys_zone=main:10m
max_size=1g inactive=1d;
proxy_temp_path /tmp/nginx/tmp;
server {
listen 80;
server_name app.example.com;
@scarsman
scarsman / README.md
Created March 6, 2017 09:57 — forked from NikitaTaranchenko/README.md
VSFTPD Installation on Ubuntu 14.04

VSFTPD Installation on Ubuntu 14.04

Install VSFTPD

$ apt install vsftpd

Configure VSFTPD with PAM

Dependencies

#
# REQUIRES:
# - server (the forge server instance)
# - site_name (the name of the site folder)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - event_id (the provisioning event name)
# - callback (the callback URL)
#
@scarsman
scarsman / install.sh
Created May 17, 2017 05:26
VPS install bash script for Ubuntu 16.04
# =================== YOUR DATA ========================
SERVER_NAME="some-server-name"
SERVER_IP="111.111.11.11"
USER="someuser"
SUDO_PASSWORD="secret-password-one"
MYSQL_ROOT_PASSWORD="secret-password-two"
#
# REQUIRES:
# - server (the forge server instance)
# - site_name (the name of the site folder)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - event_id (the provisioning event name)
# - callback (the callback URL)
#
@scarsman
scarsman / xhr-donwload.html
Created October 31, 2017 07:45 — forked from weiland/xhr-donwload.html
simple xhr downloader
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>xhr donwload</title>
</head>
<body>
<script>
var uri = 'https://domain.com/video.mp4';
var xhr = new XMLHttpRequest();
@scarsman
scarsman / node-and-npm-in-30-seconds.sh
Created November 3, 2017 02:02 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@scarsman
scarsman / proxy.py
Created December 12, 2017 05:10 — forked from tkhn/proxy.py
A very basic caching python HTTP proxy server.
# Originally from http://sharebear.co.uk/blog/2009/09/17/very-simple-python-caching-proxy/
#
# Usage:
# A call to http://localhost:80000/example.com/foo.html will cache the file
# at http://example.com/foo.html on disc and not redownload it again.
# To clear the cache simply do a `rm *.cached`. To stop the server simply
# send SIGINT (Ctrl-C). It does not handle any headers or post data.
import BaseHTTPServer
import hashlib
@scarsman
scarsman / query_finder.sql
Created July 17, 2018 06:17 — forked from mezis/query_finder.sql
Finding long-running queries in MySQL
SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120)
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;
@scarsman
scarsman / git-chop.sh
Created July 17, 2018 06:19 — forked from mezis/git-chop.sh
Close a feature branch - removing it from local and remote
#!/bin/bash
#
# Close a feature branch - removing it from local and remote.
#
die() {
echo "$@" ; exit 1
}
head=$(git symbolic-ref HEAD 2> /dev/null || git log -1 --format=%h)