Skip to content

Instantly share code, notes, and snippets.

View acro5piano's full-sized avatar
🏠
Working from home

Kay Gosho acro5piano

🏠
Working from home
View GitHub Profile
@twisty
twisty / php-syntax-check.md
Last active April 4, 2021 16:55
Check for PHP syntax errors for multiple files in a set of folders using PHP's "lint" option.

Syntax check php files in folders:

find ./foo ./bar \( -name "*.php" -or -name "*.phtml" \) -print0 | xargs -0 -n 1 php -l
@justinvoss
justinvoss / fabfile.py
Created June 20, 2011 16:05
Example Fabric and Cuisine Scrips
from deployment.cuisine import *
from fabric.api import *
from fabric.context_managers import *
from fabric.utils import puts
from fabric.colors import red, green
import simplejson
import os
@ozgun
ozgun / action_mailer_ext.rb
Created July 5, 2011 12:33
Monkeypatch ActionMailer's recipients
# config/initializers/action_mailer_ext.rb
# For Rails 2.x
if Rails.env.staging?
class ActionMailer::Base
def recipients(*params)
@recipients = "staging@example.com"
end
@hdemon
hdemon / update_by_innerjoin
Created November 18, 2011 10:13
MySQLでは自己相関サブクエリが使えないらしいので、内部結合を使って自分のテーブル内のカラムを集計し、別のカラムに入れる。
UPDATE movie_log
INNER JOIN (
SELECT
item_id,
date,
view +
(
comment *
(
@endolith
endolith / readme.md
Last active April 13, 2024 17:07
How to stream a webcam to a web browser in Ubuntu

Grr this took hours to figure out. I was trying to install MJPG-streamer and running VLC command lines and all this crap but nothing worked.

First install motion:

~> sudo apt-get install motion

Then create a config file:

~> mkdir ~/.motion

~> nano ~/.motion/motion.conf

@TooTallNate
TooTallNate / repl-client.js
Created March 26, 2012 20:09
Running a "full-featured" REPL using a net.Server and net.Socket
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)
@cuppster
cuppster / node-express-cors-middleware.js
Created April 9, 2012 16:02
express.js middleware to support CORS pre-flight requests
app.use(express.methodOverride());
// ## CORS middleware
//
// see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
@dongyuwei
dongyuwei / node-tail-f.js
Created April 13, 2012 04:31
nodejs stream tail -f to web browser
var express = require('express'), spawn = require('child_process').spawn;
var app = express.createServer();
app.use(app.router);
var tail;
app.get('/tail', function(req, res) {
res.header('Content-Type','text/html;charset=utf-8');
tail = spawn('tail', ['-f', './test.log']);
@dstroot
dstroot / install_postgresql.sh
Created June 13, 2012 00:26
Install PostgreSQL on Amazon AMI
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
@yuya-takeyama
yuya-takeyama / svn-lazydiff
Created September 27, 2012 03:17
svn diff でホワイトスペースと改行コードの両方を無視したいときに使うやつ
#!/bin/sh
svn diff --diff-cmd diff -x -uw $*