Skip to content

Instantly share code, notes, and snippets.

@alfchee
alfchee / redis-server
Created July 16, 2018 02:24 — forked from nexdrew/redis-server
Example files for running Redis on CentOS 7 (after manual install)
/var/lib/redis/logs/redis.log {
daily
rotate 14
copytruncate
delaycompress
compress
notifempty
missingok
}
@alfchee
alfchee / install_redis_on_ubuntu.md
Created June 7, 2018 17:44 — forked from torgeir/install_redis_on_ubuntu.md
Redis 2.4.8 Install on Ubuntu 10.04

Installation commands:

$ wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
$ tar xvfz redis-2.4.8.tar.gz 
$ cd redis-2.4.8/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ chown -R redis:redis /opt/redis
@alfchee
alfchee / slice_exists.go
Created April 26, 2018 00:52 — forked from r6m/slice_exists.go
golang check if item exists in slice
package main
import(
"fmt"
"reflect"
)
func main() {
items := []int{1,2,3,4,5,6}
fmt.Println(SliceExists(items, 5)) // returns true
@alfchee
alfchee / wkhtmltopdf.sh
Created July 7, 2017 21:11 — forked from Rajeshr34/wkhtmltopdf.sh
Wkhtmltopdf With Patched QT Setup Ubuntu 16+
cd ~
wget https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
mv wkhtmltox/bin/wkhtmlto* /usr/bin
apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
@alfchee
alfchee / sec_tutorial.md
Created March 9, 2017 06:46 — forked from tgrall/sec_tutorial.md
MongoDB Security Tutorial

#Simple MongoDB Security Tutorial

###1 - Start mongod without any "security option"

$ mongod --port 27017

@alfchee
alfchee / Install-Docker-on-Linux-Mint.sh
Created February 18, 2017 00:51 — forked from sirkkalap/Install-Docker-on-Linux-Mint.sh
Install Docker on Linux Mint
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
@alfchee
alfchee / 00.howto_install_phantomjs.md
Created November 9, 2016 21:49 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@alfchee
alfchee / twitter.js
Created November 9, 2016 21:27 — forked from cjoudrey/twitter.js
Lazy-rendering in PhantomJS
// This example shows how to render pages that perform AJAX calls
// upon page load.
//
// Instead of waiting a fixed amount of time before doing the render,
// we are keeping track of every resource that is loaded.
//
// Once all resources are loaded, we wait a small amount of time
// (resourceWait) in case these resources load other resources.
//
// The page is rendered after a maximum amount of time (maxRenderTime)
@alfchee
alfchee / Draggable.js
Created March 22, 2016 06:48 — forked from Rob-ot/Draggable.js
Draggable and dropable views for backbone, uses html5 drag and drop api, requires jquery and underscore, not tested in IE yet
return View.extend({
initialize: function () {
this.el.attr("draggable", "true")
this.el.bind("dragstart", _.bind(this._dragStartEvent, this))
},
_dragStartEvent: function (e) {
var data
if (e.originalEvent) e = e.originalEvent
e.dataTransfer.effectAllowed = "copy" // default to copy
@alfchee
alfchee / topkeywords.js
Created October 6, 2015 21:31 — forked from elliotbonneville/topkeywords.js
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;