Skip to content

Instantly share code, notes, and snippets.

@nguaman
nguaman / amazon-reservation.py
Created February 21, 2017 23:06 — forked from kurozumi/amazon-reservation.py
【Python】アマゾン・ホビーカテゴリの予約商品のasinと発売日を取得
# coding: utf-8
from selenium import webdriver
import re
asins=[]
driver = webdriver.PhantomJS()
for page in range(1,3):
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
@nguaman
nguaman / gist:a214660294ff29d0c77ada5e8c9984d4
Created January 16, 2017 05:16 — forked from ibogun/gist:ec0a4005c25df57a1b9d
Installing gcc 4.9 & g++ 4.9 on Ubuntu 12.04 OR Ubuntu 14.04
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
sudo apt-get install g++-4.9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50
@nguaman
nguaman / docker-compose-daemon.sh
Created November 7, 2016 16:18 — forked from domachine/docker-compose-daemon.sh
run docker-compose in daemon mode and attach to web container
docker-compose up -d
docker attach myapp_web_1
@nguaman
nguaman / www-html-file-permission-fix.md
Created November 3, 2016 15:07 — forked from nasirkhan/www-html-file-permission-fix.md
Correct permissions for /var/www and laravel wordpress

First, you should ensure that your username is included in www-data group. If not, you can add your username as www-data group

sudo adduser $USER www-data

After that, you should change the ownership of /var/www to your username

sudo chown $USER:www-data -R /var/www

Next step, you should change permission to 755 (rwxr-xr-x), not recommend changing permission to 777 for security reason

@nguaman
nguaman / class.database.php
Created August 25, 2016 18:08 — forked from jonashansen229/class.database.php
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";
@nguaman
nguaman / Php.sublime-build
Created August 11, 2016 13:07 — forked from abtris/Php.sublime-build
Sublime Text 3 - run php script at F7
{
"cmd": ["php", "$file"],
"selector": "source.php",
"target": "exec",
"variants": [
{ "cmd": ["/usr/local/php5/bin/phpunit", "$file"],
"name": "Run"
}
]
}
@nguaman
nguaman / Operaciones-Git
Created August 10, 2016 18:01 — forked from jelcaf/Operaciones-Git
Git Tips - Mini-trucos de Git para facilitarme la tarea
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@nguaman
nguaman / run.py
Created August 9, 2016 14:16 — forked from miguelmalvarez/run.py
Represent Reuters21578
from nltk import word_tokenize
from nltk.corpus import reuters
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.stem.porter import PorterStemmer
import re
from nltk.corpus import stopwords
cachedStopWords = stopwords.words("english")
def tokenize(text):
@nguaman
nguaman / install-mongodb.md
Created June 21, 2016 16:33 — forked from adamgibbons/install-mongodb.md
Install MongoDB on Mac OS X 10.9

Install MongoDB with Homebrew

brew install mongodb
mkdir -p /data/db

Set permissions for the data directory

Ensure that user account running mongod has correct permissions for the directory: