This file contains hidden or 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
| """ | |
| 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 |
This file contains hidden or 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" | |
| "crypto/des" | |
| "errors" | |
| ) | |
| func PKCS5Padding(ciphertext []byte, blockSize int) []byte { | |
| padding := blockSize - len(ciphertext)%blockSize |
This file contains hidden or 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 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 |
This file contains hidden or 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 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 |
This file contains hidden or 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 ( | |
| "encoding/binary" | |
| "log" | |
| "time" | |
| "github.com/boltdb/bolt" | |
| ) |
This file contains hidden or 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" | |
| "log" | |
| "net/http" | |
| "html/template" | |
| "github.com/gorilla/sessions" |
This file contains hidden or 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" | |
| ) | |
| type Node struct { | |
| Value int | |
| } |
This file contains hidden or 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 comp_test | |
| import ( | |
| "bytes" | |
| "compress/flate" | |
| "github.com/golang/snappy" | |
| "io" | |
| "sync" | |
| "testing" | |
| ) |
This file contains hidden or 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
| # 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 |
This file contains hidden or 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
| // 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 |