Skip to content

Instantly share code, notes, and snippets.

View ego008's full-sized avatar
🏠
Working from home

Ybb ego008

🏠
Working from home
View GitHub Profile
@ego008
ego008 / store.go
Created February 28, 2017 06:17 — forked from benbjohnson/store.go
Session Store Expiration
package store
import (
"fmt"
"github.com/boltdb/bolt"
)
// reap removes sessions older than a given duration.
// This function assumes that all session data is stored in a "sessions" bucket
@ego008
ego008 / store.go
Created February 28, 2017 06:17 — forked from benbjohnson/store.go
Session Store Expiration
package store
import (
"fmt"
"github.com/boltdb/bolt"
)
// reap removes sessions older than a given duration.
// This function assumes that all session data is stored in a "sessions" bucket
@ego008
ego008 / main.go
Created February 28, 2017 06:51 — forked from benbjohnson/main.go
Bolt for timestamp data
package main
import (
"encoding/binary"
"log"
"time"
"github.com/boltdb/bolt"
)
package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
@ego008
ego008 / gist:35d021882ff1053a2b27bd5931835cfe
Created March 20, 2017 12:46 — forked from moraes/gist:2141121
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}
package comp_test
import (
"bytes"
"compress/flate"
"github.com/golang/snappy"
"io"
"sync"
"testing"
)
@ego008
ego008 / iptables_rules.sh
Created April 10, 2017 02:41 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@ego008
ego008 / sina.go
Created April 12, 2017 06:17 — forked from border/sina.go
goauth2 for sina weibo
// Copyright 2012 Jiang Bian ([email protected]). All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Email: [email protected]
// Blog: http://wifihack.net/
// Sina WeiBo oauth2 Login, Base on goauth2 lib
package main
package main
import (
"fmt"
"math/rand"
"net/http"
"goji.io"
"goji.io/pat"
"github.com/Sirupsen/logrus"
package main
import (
"bufio"
"bytes"
"compress/flate"
"compress/gzip"
"crypto/md5"
"encoding/hex"