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 logging | |
import ( | |
"fmt" | |
"log" | |
) | |
const ( | |
DEBUG = 0 | |
INFO = 1 |
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/rand" | |
"time" | |
) | |
func pickone(ticketsize int) []int { | |
one := make([]int, ticketsize) |
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 | |
//http://play.golang.org/p/kLmBrJYchH | |
import ( | |
"fmt" | |
"time" | |
) | |
func mychan(id string, c chan string) { |
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 | |
/*test with curl | |
curl -X POST -H "Content-Type: application/json" \ | |
-d '{"method":"HelloService.Say","params":[{"Who":"Test"}], "id":"1"}' \ | |
http://localhost:10000/rpc | |
*/ | |
import ( | |
"github.com/gorilla/rpc" |
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" | |
"fmt" | |
"log" | |
"math/rand" | |
"net" | |
"time" | |
) |
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
""" | |
client.py - AsyncIO Server using StreamReader and StreamWriter | |
This will create 200 client connections to a server running server.py | |
It will handshake and run similar to this: | |
Server: HELLO | |
Client: WORLD |
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/bash | |
#Post Install for Ubuntu 14.04 LTS (Trusty) | |
#copy and paste and run - don't run this script directly | |
#you are going to need to reboot after each part. | |
echo "Don't run this script directly, copy and paste" | |
echo "the parts you will use! See the file's comments for information." | |
echo "" | |
echo "The script will run part 1 for you.. then read the file for rest!" |
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
/* | |
Simple test webserver for static content - the docs are bigger than the code! | |
1. install node and npm: http://nodejs.org/ | |
2. create a directory where you want your little web server | |
3. cd to that directory | |
4. save this file you are reading to that directory as app.js | |
5. npm install express | |
6. mkdir public |
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
feedparser | |
requests |
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
import asyncore | |
import asynchat | |
import time | |
connections_processed = 0 | |
class AServerHandler(asynchat.async_chat): | |
# def __init__(self, sock, addr, sessions, log): |