Skip to content

Instantly share code, notes, and snippets.

@atomaths
atomaths / crontabshow.sh
Last active November 13, 2015 01:08 — forked from stefanocudini/crontabshow.sh
show sorted by time, all crontab tasks defined in the system
#!/bin/bash
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
tab=$(echo -en "\t")
function clean_cron_lines() {
while read line ; do
echo "${line}" |
// サンタクロース問題
// http://karetta.jp/article/blog/oneline/030756
package main
import (
"fmt"
"math/rand"
"reflect"
"time"
)
@atomaths
atomaths / echo.go
Created April 24, 2013 02:05
Simple echo
// $ echo Hello | go run echo.go
package main
import (
"fmt"
"io"
"os"
)
@atomaths
atomaths / mail.go
Last active December 16, 2015 08:59 — forked from suapapa/spam.go
package main
import (
"flag"
"fmt"
"io/ioutil"
"net/smtp"
"os"
)
@atomaths
atomaths / nginx.conf
Last active April 17, 2024 16:11
This is a FastCGI example server in Go.
## FastCGI
server {
location ~ /app.* {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}
## Reverse Proxy (이 방식으로 하면 http.ListenAndServe로 해야함)
server {
@atomaths
atomaths / gist:5307931
Created April 4, 2013 04:56
Sort example in Go
package main
import (
"fmt"
"sort"
)
type Student struct {
Name string
Height, Weight int
@atomaths
atomaths / gist:4953725
Last active December 13, 2015 18:18
Go database/sql and mymysql package usage
package main
import (
"database/sql"
"fmt"
_ "github.com/ziutek/mymysql/godrv"
)
func OpenDB() *sql.DB {
db, err := sql.Open("mymysql", fmt.Sprintf("tcp:%s*%s/%s/%s", DB_HOST, DB_NAME, DB_USER, DB_PASS))
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
if (window.MozWebSocket) {
window.WebSocket = window.MozWebSocket;;
}