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 / tornado_websocket_ee.py
Created January 19, 2017 09:42 — forked from gnpkrish/tornado_websocket_ee.py
Realtime Communicating with front-end using simple EventEmitter. With use of Tornado + Websocket.
"""
This is a simple example of WebSocket + Tornado + Simple EventEmitters usage.
Thanks to pyee by https://github.com/jesusabdullah
@Author:: Narayanaperumal G <gnperumal@gmail.com>
"""
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
from collections import defaultdict
@ego008
ego008 / des.go
Created February 22, 2017 07:44 — forked from cuixin/des.go
des ecb mode in golang
package main
import (
"bytes"
"crypto/des"
"errors"
)
func PKCS5Padding(ciphertext []byte, blockSize int) []byte {
padding := blockSize - len(ciphertext)%blockSize
@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 (borderj@gmail.com). All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Email: borderj@gmail.com
// Blog: http://wifihack.net/
// Sina WeiBo oauth2 Login, Base on goauth2 lib
package main