Skip to content

Instantly share code, notes, and snippets.

View Shellbye's full-sized avatar
🎯
Focusing

shellbye Shellbye

🎯
Focusing
  • Momenta
  • Beijing, China
  • 11:42 (UTC -12:00)
View GitHub Profile
@Shellbye
Shellbye / set_up_http_proxy
Last active August 29, 2015 14:14
set up http proxy
#!/bin/sh
sudo apt-get update
sudo apt-get install -y squid3
sudo cp /etc/squid3/squid.conf /etc/squid3/squid.conf.original
sudo chmod a-w /etc/squid3/squid.conf.original
echo "use vim /etc/squid3/squid.conf to change port(default 3128) and http_access allow"
# change port: http_port 8888
# allow access: http_access allow all <==this should at top of all http_access
# ref: https://help.ubuntu.com/lts/serverguide/squid.html
@Shellbye
Shellbye / basic_squid3
Created February 9, 2015 08:28
squid3 basic authentication
# ref http://stackoverflow.com/questions/3297196/how-to-set-up-a-squid-proxy-with-basic-username-and-password-authentication
# first install apache:
# $ sudo apt-get install -y apache2-utils
# add these five lines to /etc/squid3/squid.conf
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_port 3128 # or whatever you like
@Shellbye
Shellbye / install_scrapy_in_centos_6_5.sh
Last active November 26, 2016 04:36
Install scrapy in CentOS 6.5 in virtualenv, and install mysql to store the data crawled. After the installation, the `spider` dir will contains all the downloaded files and the `spider_env` is the virtualenv dir
#!/usr/bin/env bash
mkdir spider
cd spider/
yum update -y
# install pip on centos6
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install -y python-pip
# install wget
yum install -y wget
@Shellbye
Shellbye / CentOS_version_check.sh
Created April 26, 2016 06:18
Some command to check CentOS version
# https://forum.directadmin.com/showthread.php?t=15878
cat /etc/*release*
cat /etc/centos-release # http://www.liquidweb.com/kb/how-to-check-your-centos-version/
cat /etc/redhat-release
# https://linuxconfig.org/how-to-check-centos-version
# the later two may need some package to install
rpm --query centos-release
@Shellbye
Shellbye / install_twisted_16_1_1
Created April 26, 2016 08:13
Install Twisted-16.1.1
wget https://pypi.python.org/packages/source/T/Twisted/Twisted-16.1.1.tar.bz2
tar -jvxf Twisted-16.1.1.tar.bz2
cd Twisted-16.1.1
python setup.py install
@Shellbye
Shellbye / install_pip_on_CentOS7.2
Created April 29, 2016 01:45
Install pip on CentOS7.2
# http://www.liquidweb.com/kb/how-to-install-pip-on-centos-7/
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
sudo python get-pip.py
@Shellbye
Shellbye / setup.sh
Created June 1, 2016 10:04
setup_django_in_ubuntu_1404.sh
#!/usr/bin/env bash
apt-get update
apt-get install -y python-pip
pip install django==1.8.6 # or use install_django_without_pip.sh
@Shellbye
Shellbye / install_django_without_pip.sh
Created June 1, 2016 10:06
install_django_without_pip
#!/usr/bin/env bash
wget https://www.djangoproject.com/m/releases/1.8/Django-1.8.6.tar.gz
tar -xvzf Django-1.8.6.tar.gz
cd Django-1.8.6
python setup.py install
@Shellbye
Shellbye / install_pillow_in_ubuntu_1404.sh
Created June 2, 2016 02:02
install_pillow_in_ubuntu_1404
#!/usr/bin/env bash
wget https://pypi.python.org/packages/e2/af/0a3981fffc5cd43078eb8b1057702e0dd2d5771e5aaa36cbd140e32f8473/Pillow-3.2.0.tar.gz#md5=7cfd093c11205d9e2ebe3c51dfcad510
tar -xzvf Pillow-3.2.0.tar.gz
cd Pillow-3.2.0
apt-get update
apt-get install -y libjpeg-dev # ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting
apt-get install -y zlib1g-dev # ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting
apt-get install -y python-dev # error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
@Shellbye
Shellbye / deploy.sh
Last active August 9, 2016 08:35
setup django site with nginx and uwsgi
#!/usr/bin/env bash
# install nginx & uwsgi
sudo apt-get install nginx
pip install uwsgi
# connect ngxin to django site
ln -s /path/to/your/mysite/mysite_nginx.conf /etc/nginx/sites-enabled/
# restart or start whatever needed