Skip to content

Instantly share code, notes, and snippets.

View utok's full-sized avatar

tondang toguh utok

  • indonesia
View GitHub Profile
@utok
utok / myexercise
Last active August 29, 2015 14:24
python basic treehouse exercise
#string concatenation 02
name = raw_input("what's your name ?")
if name == "jack":
print(name + " is cool")
else:
print(name + " is not cool")
#string concatenation 03
name = raw_input("what's your name ?")
if name == "jack":
print("{} is cool".format(name))
@utok
utok / installandtrytorun
Created July 6, 2015 15:13
learn machine-learning python
machine learning
## make virtualenv
mkvirtualenv machine-learning
## install security to prevent sslinsecure
pip install requests[security]
@utok
utok / apalahyaversidua
Created July 2, 2015 14:32
flask folder and template file using passenger v2
#!/bin/bash
#### Create some directory
HOMEDIR=/home/$USER
APPSDIR=$HOMEDIR/app
PASSDIR=$APPSDIR/public
TEMPLATEDIR=$APPSDIR/templates
TMPDIR=$APPSDIR/tmp
STATICDIR=$APPSDIR/static
for i in "$APPSDIR" "$PASSDIR" "$TEMPLATEDIR" "$TMPDIR" "$STATICDIR"; do
mkdir -p "$i"
@utok
utok / apalahyaversisatu
Created July 2, 2015 14:26
flask folder and template file using passenger
#!/bin/bash
HOMEDIR=/home/$USER
APPSDIR=$HOMEDIR/apps
APPDIR=$APPSDIR/app
TEMPLATEDIR=$APPSDIR/templates
PASSDIR=$APPSDIR/public
TMPDIR=$APPSDIR/tmp
STATICDIR=$APPSDIR/static
for i in "$APPSDIR" "$APPDIR" "$TEMPLATEDIR" "$TMPDIR" "$PASSDIR" "$STATICDIR"; do
mkdir -p "$i"
@utok
utok / nginx
Created June 30, 2015 07:58
nginx init.d
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu or other *nix.
# Description: nginx init.d dash script for Ubuntu or other *nix.
### END INIT INFO
@utok
utok / pass
Last active February 21, 2016 04:16
passenger nginx pagespeed pcre moreheader
#download source nginx
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar -xvzf nginx-1.8.0.tar.gz
#download module
#pagespeed
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-1.9.32.4-beta.zip
unzip release-1.9.32.4-beta.zip
cd ngx_pagespeed-release-1.9.32.4-beta/
wget https://dl.google.com/dl/page-speed/psol/1.9.32.4.tar.gz
tar -xzvf 1.9.32.4.tar.gz # extracts to psol/
@utok
utok / support
Created June 30, 2015 00:12
supporting
sudo apt-get install imagemagick
@utok
utok / vpenv
Last active August 29, 2015 14:23
python env
sudo apt-get install python-pip python-dev
source .bashrc
pip install --user virtualenv
pip install --user virtualenvwrapper
nano .bashrc
export PATH=$HOME/.local/bin:$PATH
export WORKON_HOME=$HOME/.virtenvs
export PROJECT_HOME=$HOME/Devel
source $HOME/.local/bin/virtualenvwrapper.sh
pip install pyopenssl ndg-httpsclient pyasn1
@utok
utok / vbir
Last active August 29, 2015 14:23
vagrant box instal ruby
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bash
source .bashrc
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 2.2.2
rbenv global 2.2.2
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
@utok
utok / using vagrant
Created June 29, 2015 05:04
using vagrant
download from vagrant.es
wget https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-i386-vagrant-disk1.box
install vagrant
vagrant box add foo-box /path/to/vagrant-box.box
vagrant init foo-box
vagrant up