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/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
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
var dataset = [ | |
{ | |
"Year":2003, | |
"Quarter":"Q1", | |
"OperatingCashFlow":3410, | |
"Revenue":1475, | |
"Operating Income":4, | |
"QEndDate":"3/31/2003", | |
"StockClose":14.14 | |
}, |
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
<div id="sparklines"></div> | |
<style> | |
path { | |
stroke-width: 2; | |
fill: none; | |
} | |
path.wind { stroke: red; } | |
path.power { stroke: steelblue; } |
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
package main | |
import "fmt" | |
import "math" | |
var pow = math.Pow | |
var sqrt = math.Sqrt | |
func main() { | |
x1, y1 := 0, 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
package main | |
import ( | |
"bytes" | |
"encoding/csv" | |
// "encoding/json" | |
"fmt" | |
"io/ioutil" | |
"strings" | |
) |
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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func main() { | |
// set of probabilities |
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
package main | |
import "fmt" | |
func main() { | |
s := make(chan int) | |
X(s) | |
fmt.Println(<-s) | |
} |
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
package main | |
import ( | |
"bufio" | |
"database/sql" | |
"encoding/json" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" |
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
package main | |
import "regexp" | |
func CleanQuery(q string) string { | |
r1 := regexp.MustCompile(`\s+`) | |
r2 := regexp.MustCompile(`--[^\n]*\n`) | |
q = r2.ReplaceAllString(q, "") | |
return r1.ReplaceAllString(q, " ") | |
} |
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
// heavily borrowed from Rosetta Code example | |
package main | |
import "fmt" | |
type row map[string]interface{} | |
var ( | |
tableA = []row{ | |
row{"name": "Jonah", "age": 27}, |
OlderNewer