Skip to content

Instantly share code, notes, and snippets.

Victor Ng crankycoder

Block or report user

Report or block crankycoder

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:64566d8c6de1243890c85ba80eb96c0e
-bash-4.2$ pytest
========================================= test session starts ==========================================
platform linux2 -- Python 2.7.12, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/hadoop/taar, inifile:
plugins: cov-2.5.1
collected 24 items
test_collaborativerecommender.py ....
test_legacyrecommender.py ...
test_localerecommender.py ....
@crankycoder
crankycoder / smartplug.py
Created Jun 8, 2016 — forked from arminwasicek/smartplug.py
Simple library/command-line-utility to control a EDIMAX Smart Plug Switch (SP-1101W) from Python
View smartplug.py
##
# The MIT License (MIT)
#
# Copyright (c) 2014 Stefan Wendler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@crankycoder
crankycoder / building-static-nginx.txt
Created May 26, 2016 — forked from rjeczalik/building-static-nginx.txt
Notes on building nginx as a static binary.
View building-static-nginx.txt
# Building static nginx for teh lulz
#
# basic dependencies
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev
# download nginx and openssl
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6
@crankycoder
crankycoder / gist:34d11a9f8202a10f3adb
Created Oct 1, 2014
Bootstrap Ubuntu 14.04 into a workable MozStumbler buildbox
View gist:34d11a9f8202a10f3adb
#!/bin/sh
sudo apt-get -qqy update
sudo apt-get install -y unzip git make openjdk-7-jdk
# Everybody loves that android needs x86 stuff
sudo dpkg --add-architecture i386
sudo apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386
View blogpost.md

Save books out of Safari Books Online

From http://objectivesea.tumblr.com/post/9033067018/safaribooks

This is hard. I spent way too much time figuring this out, because I was annoyed that a book I bought (Addison-Wesley) was available online for free, except only for 45 days after which payment was required. So I made this hack... probably useful to no one else, but here it is.

Requirements:

  1. iPad.
  2. Safari To Go (the Safari Books Online iPad app).
View gist:7606731
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-- Original grok filters
-- POSINT \b(?:[0-9]+)\b
-- GREEDYDATA .*
-- HOUR (?:2[0123]|[01][0-9])
-- MINUTE (?:[0-5][0-9])
-- SECOND (?:(?:[0-5][0-9]|60)(?:[.,][0-9]+)?)
@crankycoder
crankycoder / gist:7606676
Created Nov 22, 2013
TOML config to debug syslog over UDP problems
View gist:7606676
[UdpInput]
address = "127.0.0.1:2514"
parser_type = "packet"
decoder = "syslog_sandbox"
[syslog_sandbox]
type = "SandboxDecoder"
script_type = "lua"
filename = "/tmp/syslog_decoder.lua"
timestamp_field = "syslog_ts"
@crankycoder
crankycoder / gist:7606664
Created Nov 22, 2013
netsyslog.py example
View gist:7606664
#!/usr/bin/python
import socket
import time
FACILITY = {
'kern': 0, 'user': 1, 'mail': 2, 'daemon': 3,
'auth': 4, 'syslog': 5, 'lpr': 6, 'news': 7,
'uucp': 8, 'cron': 9, 'authpriv': 10, 'ftp': 11,
'local0': 16, 'local1': 17, 'local2': 18, 'local3': 19,
@crankycoder
crankycoder / gist:6302667
Last active Dec 21, 2015
Ubuntu Discourse install docs
View gist:6302667

Official Discourse Install Guide

Recommended Server Hardware

  • 2 GB of RAM
  • 2 GB of swap
  • 2 processor cores

With 2 GB of memory and dual cores, you can run two instances of the thin server (NUM_WEBS=2), and easily host anything but the largest of forums.

@crankycoder
crankycoder / gist:6181211
Last active Dec 20, 2015 — forked from surrealroad/gist:5146661
Digital Ocean Discourse production install with LAMP (using Apache)
View gist:6181211
#create & deploy lamp droplet
#login via ssh as root
#initial setup (ref: http://library.linode.com/getting-started#sph_logging-in-for-the-first-time)
# update /etc/hosts (to "thalassophobia.surrealroad.com")
nano /etc/hosts
#
You can’t perform that action at this time.