Skip to content

Instantly share code, notes, and snippets.

@premist
premist / wp-config.php
Created May 25, 2012 08:51
Enable WordPress's direct core update or plugin/theme install
<?php
/* After "that's all, stop editing! Happy blogging.", put these lines.
Change permission value(default is 0755) if you want. */
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0755 );
}
@premist
premist / nodeserv
Created June 18, 2012 12:49
NodeServ + forever init.d script
#! /bin/bash -e
set -e
PATH=/usr/bin
DAEMON=/opt/NodeServ/server.js
case "$1" in
start) forever start $DAEMON ;;
stop) forever stop $DAEMON ;;
force-reload|restart)
forever restart $DAEMON ;;
*) echo "Usage: /etc/init.d/nodeserv {start|stop|restart|force-reload}"
@premist
premist / gist:3235577
Created August 2, 2012 08:56 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@premist
premist / readFileCache.js
Created September 7, 2012 08:38
readFileCache.js: fs.readFile LRU(Least Recently Used) Cache for Node.js
// readFileCache.js
// fs.readFile LRU(Least Recently Used) Cache for Node.js
// This module will cache file data automatically on memory
// in order to serve the data faster for repetitive requests.
// Usage:
// var cache = require('./readFileCache.js');
// cache.readFile('./index.html', 'utf-8', function(err, data) {
// response.write(data);
@premist
premist / autodeploy.rb
Created December 10, 2012 17:03
Dead simple auto-deploy script for REMU
require 'sinatra'
require 'json'
post '/' do
puts "Something is coming..."
if(!params[:payload])
return "Not Github request - ignoring"
puts "Someone is bothering me."
end
@premist
premist / cgminer.rb
Last active August 13, 2021 01:29
Install cgminer on Mac OS X using homebrew
require 'formula'
# Original : https://raw.github.com/Kaelten/homebrew/master/Library/Formula/cgminer.rb
class Cgminer < Formula
homepage 'https://github.com/ckolivas/cgminer'
url 'https://github.com/ckolivas/cgminer/archive/v2.10.4.zip'
sha1 'cf592852b913749378db7f43a561b90c2b6448be'
depends_on 'automake' => :build
@premist
premist / downmark_it.rb
Created July 7, 2013 06:53
WordPress to Jekyll
# =Overview
# DownmarkIt is a library to convert HTML to markdown, based on Hpricot[http://github.com/hpricot/hpricot/].
#
# =Motivation
# While working on our company's new CMS, I needed to parse HTML back to markdown and surprisngly there wasn't any solution that could fit our enviroment, so I decided to make my own and share it :)
#
# =Usage
# Make sure you install Hpricot[http://github.com/hpricot/hpricot/] first, then require the library in your application, if you are using the library in a rails application, just place it in your lib folder, then use this method to convert HTML into markdown.
# markdown = DownmarkIt.to_markdown(html)
#
@premist
premist / tomorrow-night-eighties.js
Created October 8, 2013 06:56
Tomorrow Night Eighties colorset on Chrome Secure Shell
term_.prefs_.set('cursor-blink', true);
term_.prefs_.set('background-color', '#2d2d2d');
term_.prefs_.set('foreground-color', '#cccccc');
term_.prefs_.set('cursor-color', '#515151');
term_.prefs_.set('color-palette-overrides', [
'#515151',
'#f2777a',
'#99cc99',
'#ffcc66',
@premist
premist / ipfw.conf
Last active December 27, 2015 15:49
Vagrant LaunchDaemon to forward ports Reference : http://www.dmuth.org/node/1404/web-development-port-80-and-443-vagrant
#
# Flush all of our pre-existing rules.
#
flush
#
# Forward port 80 to our Vagrant instance.
#
add 100 fwd 127.0.0.1,8080 tcp from any to me 80
@premist
premist / gpac.rb
Last active August 29, 2015 14:04
Head-only GPAC formula for Homebrew
require 'formula'
# Borrowed from https://github.com/Homebrew/homebrew/blob/master/Library/Formula/gpac.rb
# License : https://github.com/Homebrew/homebrew/blob/master/LICENSE.txt
# Installs a relatively minimalist version of the GPAC tools. The
# most commonly used tool in this package is the MP4Box metadata
# interleaver, which has relatively few dependencies.
#
# The challenge with building everything is that Gpac depends on