Skip to content

Instantly share code, notes, and snippets.

View v9n's full-sized avatar
🛫
forward email at mailwip.com

Vinh v9n

🛫
forward email at mailwip.com
View GitHub Profile
@v9n
v9n / LICENSE.txt
Created August 3, 2011 02:10 — forked from 140bytes/LICENSE.txt
Element Filter V2 (ref#1120350)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@v9n
v9n / 3columns.php
Created August 14, 2011 22:47
Magento default Page Layout
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@v9n
v9n / shot.sh
Created August 15, 2011 08:54
Take Screeenshot and upload to some servies
#!/bin/bash
#
domain="http://localhost:4567"
file="/tmp/shot.$RANDOM.png"
import -window root $file
curl -v -F "file=@$file" $domain/upload
notify-send "Uploaded $file"
rm $file
@v9n
v9n / kohana_routre.php
Created December 13, 2011 19:42
Get name of current URI in a request
<?php
//Request::current()->uri is equal to $this->reqest->uri() in normal request or in first request of HMVC
//echo $this->request->uri(), Request::current()->uri();
//echo Route::name($this->request->route()); exit;
if (!$auth->logged_in() && (!in_array(Route::name($this->request->route()), $this->_requireAuthen) || Route::name(new Route(Request::current()->uri()))=='hash' ) ) {
$this->request->redirect('account/login');
}
@v9n
v9n / detail.php
Created December 23, 2011 10:02
get playlist and schedule
<?php
class Model_Schedule_Detail extends Sprig {
protected function _init() {
$this->_fields += array(
'id' => new Sprig_Field_Auto,
'schedule' => new Sprig_Field_BelongsTo(array(
'model' => 'schedule',
'column' => 'schedule_id',
@v9n
v9n / mysqldump_resore.sh
Created January 8, 2012 02:24
Restore and Dump mysql
mysql -u root -p secret dbname < db.sql
mysql -u root -p secret
mysql> create database mydb;
mysql> use mydb;
mysql> source db_backup.dump;
@v9n
v9n / recursive_rm.sh
Created March 1, 2012 18:48
recursive remove particular files
find . -type f -name '*.jpg' -exec command {} \;
@v9n
v9n / system_status_report.sh
Created March 16, 2012 18:54
Server status report in crond
*/15 * * * * echo -e "Subject: Server Status\nDaemon:\n" > /tmp/slog; ps -A >> /
tmp/slog; top - n 1 -b >> /tmp/slog; cat /tmp/slog | sendmail -f daemon@axcoto.
com [email protected]
@v9n
v9n / event_buffering.md
Created March 26, 2012 20:18 — forked from ryandotsmith/event_buffering.md
event buffering

Event Buffering

Eventually platforms outgrow the single-source-tree model and become distributed systems. A common pattern in these distributed systems is distributed composition via event buffering. Here we motivate and describe this event buffering pattern.

The Problem

@v9n
v9n / unremoving.sh
Created April 10, 2012 16:10
use xargs to get back all manually removed files
"git ls-files -d | xargs git checkout --"