Skip to content

Instantly share code, notes, and snippets.

@joylobo
joylobo / polipo.sh
Created July 8, 2021 12:41 — forked from scalaview/polipo.sh
Convert Shadowsocks into an HTTP proxy
First run polipo with parent proxy set to Shadowsocks:
apt-get install polipo
service polipo stop
polipo socksParentProxy=localhost:1080
Then you can play with the HTTP proxy:
http_proxy=http://localhost:8123 apt-get update
# git
git config http.proxy http://localhost:8123 # for current directory
git config --global http.proxy http://localhost:8123 # global config
# choco
choco config set proxy http://10.200.241.222:8118
@joylobo
joylobo / GitConfigHttpProxy.md
Created June 30, 2021 10:56 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@joylobo
joylobo / gist:26d8f1520b5b00e9f0898e980b800f78
Created July 3, 2017 04:57 — forked from ivan-loh/gist:ee0d96c3795e59244063
Node.JS ( & pm2 ) Process Memory Limit
# Plain Ol' Node
node --max-old-space-size=1024 app.js # increase to 1gb
node --max-old-space-size=2048 app.js # increase to 2gb
node --max-old-space-size=3072 app.js # increase to 3gb
node --max-old-space-size=4096 app.js # increase to 4gb
node --max-old-space-size=5120 app.js # increase to 5gb
node --max-old-space-size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb
@joylobo
joylobo / rpi_gpio.sh
Created June 22, 2017 05:20 — forked from pdp7/rpi_gpio.sh
Raspberry Pi GPIO demo shell script
#!/bin/sh
# Updated for foo feature
#
# GPIO numbers should be from this list
# 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25
# Note that the GPIO numbers that you program here refer to the pins
# of the BCM2835 and *not* the numbers on the pin header.
# So, if you want to activate GPIO7 on the header you should be
# using GPIO4 in this script. Likewise if you want to activate GPIO0
@joylobo
joylobo / ngrokd.service
Created June 21, 2017 06:46
/etc/systemd/system/ngrokd.service
[Unit]
Description=Share local port(s) with ngrokd
After=syslog.target network.target
[Service]
PrivateTmp=true
Type=simple
Restart=always
RestartSec=1min
StandardOutput=null
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=nginx
NGINX_BIN=/usr/local/nginx/sbin/$NAME
CONFIGFILE=/usr/local/nginx/conf/$NAME.conf
PIDFILE=/usr/local/nginx/logs/$NAME.pid
if [ -s /bin/ss ]; then
StatBin=/bin/ss
else
Get_Dist_Version()
{
if [ -s /usr/bin/python3 ]; then
eval ${DISTRO}_Version=`/usr/bin/python3 -c 'import platform; print(platform.linux_distribution()[1])'`
elif [ -s /usr/bin/python2 ]; then
eval ${DISTRO}_Version=`/usr/bin/python2 -c 'import platform; print platform.linux_distribution()[1]'`
fi
if [ $? -ne 0 ]; then
Install_LSB
eval ${DISTRO}_Version=`lsb_release -rs`
@joylobo
joylobo / simple-nginx-webdav.sh
Created June 20, 2017 05:17 — forked from dysinger/simple-nginx-webdav.sh
A simple nginx/webdav setup for use with things like mobile-org
#!/bin/sh
# on ubuntu: need some utils & dev libs
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev
# compile nginx
cd /tmp
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz
cd nginx*
./configure --with-http_ssl_module --with-http_dav_module \
@joylobo
joylobo / pm2 check
Created June 15, 2017 06:53
check if a pm2 process with given name is running
#!/bin/bash
pm2 describe appname > /dev/null
RUNNING=$?
if [ "${RUNNING}" -ne 0 ]; then
pm2 start ./deploy/development.yml
else
pm2 restart appname
fi;