Skip to content

Instantly share code, notes, and snippets.

View tobsn's full-sized avatar

Tobsn tobsn

  • US/EU/SEA
View GitHub Profile
@mattzuba
mattzuba / 01_httpd_phpfpm.config
Last active December 20, 2022 19:53
Apache 2.4 / PHP-FPM 5.5 on Amazon Elastic Beanstalk
packages:
yum:
php55-fpm: []
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/26_phpfpm_config.sh":
mode: "000755"
owner: root
group: root
content: |
@dragolabs
dragolabs / nginx-vbulletn.conf
Created August 2, 2013 04:06
nginx config for vbulletin 5 forum. And read the comments in config.php: // ****** Base URLs ****** // The following settings all deal with the url of your forum. // If set incorrectly your site/software will not function correctly. // These urls should NOT include a trailing slash <------- !!! // This is the url and web path of your root vBulle…
server {
listen 80;
server_name forum.example.com;
root /var/www/example_forum/;
index index.php;
access_log /var/log/nginx/forum.example.access.log main;
error_log /var/log/nginx/forum.example.error.log;
@bjinwright
bjinwright / .config
Created May 10, 2013 15:17
AWS Elastic Beanstalk container commands for installing mod_pagespeed. This example uses a Django application but just strip out commands 1 and 2 and it usable by any application. This is the follow up to the https://gist.github.com/bjinwright/5554958 Gist that shows how to setup the Apache conf file that makes this work.
container_commands:
01_collectstatic:
command: "django-admin.py collectstatic --noinput"
02_lesscss:
command: "lesscpy -x static/css/base.less > static/css/base.css"
03_setup_apache:
command: "cp enable_mod_pagespeed.conf /etc/httpd/conf.d"
04_rm_pagespeed:
command: "rm -rf /pagespeed/ebextensions"
05_mkdir_pagespeed:
@lobodin
lobodin / README.md
Last active March 30, 2023 06:23
Import GeoNames.org cities data to mongodb.

#Generate cities data

  1. wget http://download.geonames.org/export/dump/cities15000.zip
  2. unzip cities15000.zip
  3. node geonames.js cities15000.txt

The result is json array of cities in the following format:

{

_id:

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@JeffreyWay
JeffreyWay / snippet.xml
Created September 13, 2012 20:23
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
<?php
require 'vendor/autoload.php';
$loop = new React\EventLoop\StreamSelectLoop();
$app = function ($request, $response) use ($loop) {
$response->writeHead(200, []);
$fh = fopen('http://localhost/', 'r');
@purwandi
purwandi / base.php
Created June 15, 2012 02:14
My Base Model for Laravel
<?php
/**
* Base Model
*
* @package Extends Model Laravel
* @version 1.0
* @author Purwandi <free6300@gmail.com>
* @link http://purwand.me
*/
class Base extends Eloquent{
@tobsn
tobsn / taffydb.capping.js
Created May 5, 2012 10:19
capping taffydb
TAFFY.extend( 'capped', function( i, runInsert, runRemove ) {
var c = this.getDBI().cap || false;
if( c && ( c < ( this.count() + 1 ) ) ) {
while( c < ( this.count() + 1 ) ) {
this.getDBI().remove( this.context().results[0].___id );
this.context({
run: null
});
this.getDBI().removeCommit( runRemove );
}
@jonavon
jonavon / CIDR.php
Created March 13, 2012 13:50
CIDR class for IPv4
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <jowilcox@vt.edu>
* @revision Carlos Guimarães <cvsguimaraes@gmail.com>
* @version Wed Mar 12 13:00:00 EDT 2014
*/