This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Adapted from Tom Cunningham's 'Data Warehousing with MySql' (www.meansandends.com/mysql-data-warehouse) */ | |
###### small-numbers table | |
DROP TABLE IF EXISTS numbers_small; | |
CREATE TABLE numbers_small (number INT); | |
INSERT INTO numbers_small VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); | |
###### main numbers table | |
DROP TABLE IF EXISTS numbers; | |
CREATE TABLE numbers (number BIGINT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'sqlite3' | |
cite_part = ARGV[0] | |
db_name = "/Users/nernst/Library/Application\ Support/Mendeley\ Desktop/neil\@neilernst.net\@www.mendeley.com.sqlite" | |
db = SQLite3::Database.new( db_name ) | |
db.results_as_hash = true | |
query = "select citationkey, title, year from Documents where citationkey like '%#{cite_part}%'"#MATCH '#{cite_part}'"#{}like '%#{cite_part}%'" | |
db.execute( query ) do |row| | |
print row['citationKey'] + '|' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* CakePHP Helper Code Completion | |
* @author junichi11 | |
* | |
* install NetBeans 7.0 && cakephp-netbeans plugin | |
* http://netbeans.org | |
* https://github.com/evilbloodydemon/cakephp-netbeans/tree/autocomplete | |
* /path/to/yourproject/nbproject/cake_helper_code_completion.php | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Author: Ngo Minh Nam | |
$dir = "/path/to/your/repo/"; | |
$output = array(); | |
chdir($dir); | |
exec("git log",$output); | |
$history = array(); | |
foreach($output as $line){ | |
if(strpos($line, 'commit')===0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Author: Ngo Minh Nam | |
$dir = "/path/to/your/repo/"; | |
$output = array(); | |
chdir($dir); | |
// Linux | |
exec("git log",$output); | |
// Windows | |
exec('"C:\Program Files (x86)\Git\bin\git.exe" ' ."log", $output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#### | |
# Split MySQL dump SQL file into one file per table | |
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump | |
#### | |
if [ $# -lt 1 ] ; then | |
echo "USAGE $0 DUMP_FILE [TABLE]" | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE E INT DEFAULT 0; | |
DECLARE M TEXT DEFAULT NULL; | |
DECLARE CONTINUE HANDLER FOR 1000 SET E='1000', M="hashchk"; | |
DECLARE CONTINUE HANDLER FOR 1001 SET E='1001', M="isamchk"; | |
DECLARE CONTINUE HANDLER FOR 1002 SET E='1002', M="NO"; | |
DECLARE CONTINUE HANDLER FOR 1003 SET E='1003', M="YES"; | |
DECLARE CONTINUE HANDLER FOR 1004 SET E='1004', M="Can't create file '%s' (errno: %d)"; | |
DECLARE CONTINUE HANDLER FOR 1005 SET E='1005', M="Can't create table '%s' (errno: %d)"; | |
DECLARE CONTINUE HANDLER FOR 1006 SET E='1006', M="Can't create database '%s' (errno: %d)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBackgroundColor(rangeSpecification) { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet(); | |
return sheet.getRange(rangeSpecification).getBackground(); | |
} | |
function getForegroundColor(rangeSpecification) { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet(); | |
return sheet.getRange(rangeSpecification).getFontColor(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
?mpg | |
head(mpg) | |
str(mpg) | |
# Identify a scatter point | |
attach(mtcars) | |
plot(mpg, wt) | |
identify(x = mpg, y = wt, n = 3, label = row.names(mtcars)) | |
detach(mtcars) |
OlderNewer