Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// "License": Public Domain | |
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. | |
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to | |
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it | |
// an example on how to get the endian conversion functions on different platforms. | |
#ifndef PORTABLE_ENDIAN_H__ | |
#define PORTABLE_ENDIAN_H__ | |
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
class Foo | |
attr_reader :bar | |
def initialize | |
@bar = 123 | |
ObjectSpace.define_finalizer( self, self.class.finalize(bar) ) | |
end | |
def self.finalize(bar) | |
proc { puts "DESTROY OBJECT #{bar}" } | |
end |
server{ | |
listen 80; | |
server_name example.com; | |
access_log /home/path_to_site/access.log; | |
error_log /home/path_to_site/error.log; | |
location / { | |
proxy_pass http://0.0.0.0:8002; | |
proxy_set_header Host $host; |
# Inspired by http://stackoverflow.com/a/149099/1649199 | |
Number::formatMoney = (t=',', d='.', c='$') -> | |
n = this | |
s = if n < 0 then "-#{c}" else c | |
i = Math.abs(n).toFixed(2) | |
j = (if (j = i.length) > 3 then j % 3 else 0) | |
s += i.substr(0, j) + t if j | |
return s + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) |
import os | |
import sys | |
import traceback | |
from functools import wraps | |
from multiprocessing import Process, Queue | |
def processify(func): | |
'''Decorator to run a function as a process. | |
Be sure that every argument and the return value |
namespace :unicorn do | |
## | |
# Tasks | |
desc "Start unicorn" | |
task(:start) { | |
config = rails_root + "config/unicorn.rb" | |
sh "bundle exec unicorn --daemonize --config-file #{config}" | |
} |
#!/usr/bin/perl | |
# Author: Todd Larason <[email protected]> | |
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ | |
# use the resources for colors 0-15 - usually more-or-less a | |
# reproduction of the standard ANSI colors, but possibly more | |
# pleasing shades | |
# colors 16-231 are a 6x6x6 color cube | |
for ($red = 0; $red < 6; $red++) { |
# ~/.tmux.conf | |
# | |
# See the following files: | |
# | |
# /opt/local/share/doc/tmux/t-williams.conf | |
# /opt/local/share/doc/tmux/screen-keys.conf | |
# /opt/local/share/doc/tmux/vim-keys.conf | |
# | |
# URLs to read: | |
# |
# Rake task to launch multiple Resque workers in development/production with simple management included | |
require 'resque/tasks' # Require Resque tasks | |
namespace :workers do | |
# = $ rake workers:start | |
# | |
# Launch multiple Resque workers with the Rails environment loaded, | |
# so they have access to your models, etc. |