Skip to content

Instantly share code, notes, and snippets.

View wonjun27's full-sized avatar
🎯
Focusing

Won Jun Bae wonjun27

🎯
Focusing
View GitHub Profile
@wonjun27
wonjun27 / how-to-view-source-of-chrome-extension.md
Last active August 28, 2015 14:15 — forked from paulirish/how-to-view-source-of-chrome-extension.md
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=unknown&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@wonjun27
wonjun27 / config.app.php
Last active August 29, 2015 02:01 — forked from fideloper/config.app.php
Master-Slave database in CodeIgniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//Create a new config file
/*
|--------------------------------------------------------------------------
| Number of databases in use
|--------------------------------------------------------------------------
|
| Using a Master and Slave. The Slave doubles as a read-only database.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();
Capistrano::Configuration.instance(:must_exist).load do
# example execution 'cap bundle_app -s version=HEAD'
desc "Bundle code and push to S3"
task :bundle_app do
puts "Starting Git archive of #{version}"
`git archive -o oldweather.tar #{version}`
`gzip oldweather.tar`
s3_upload
clean_up
#!/home/ec2-user/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
require 'rubygems'
require 'aws/s3'
require 'fileutils'
AWS::S3::Base.establish_connection!(
:access_key_id => 'access_key',
:secret_access_key => 'secret_key'
)
@wonjun27
wonjun27 / README.md
Last active August 29, 2015 14:07 — forked from oodavid/README.md

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@wonjun27
wonjun27 / README.md
Last active August 29, 2015 14:07 — forked from oodavid/README.md

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

@wonjun27
wonjun27 / copy_db.sql
Last active August 29, 2015 14:07 — forked from swrobel/copy_db.sql
DELIMITER $$
DROP PROCEDURE IF EXISTS `CopyDB` $$
CREATE PROCEDURE `CopyDB` (sourceDB VARCHAR(64),targetDB VARCHAR(64))
TheStoredProcedure:BEGIN
DECLARE found_count,ndx,ndx_last INT;
DECLARE sqlcmd VARCHAR(1024);
SELECT COUNT(1) INTO found_count
FROM information_schema.tables
// jshint node:true
'use strict';
var semver = require('semver'),
exec = require('exec');
module.exports = function(grunt) {
'use strict';
require('load-grunt-tasks')(grunt);

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.