Skip to content

Instantly share code, notes, and snippets.

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

Travis Person travisperson

🏠
Working from home
View GitHub Profile
var running = false;
module.exports = function run(opts) {
if (running) throw new Error('Already running');
running = true;
// do stuff
}
var request = require('request');
var htmlparser = require('htmlparser');
var handler = new htmlparser.RssHandler();
var parser = new htmlparser.Parser(handler);
request.get('http://feeds.bbci.co.uk/news/rss.xml', function (err, resp, body) {
parser.parseComplete(body);
var items = handler.dom.items;
curl 'http://localhost:3000/api/v0/add?w=true&stream-channels=true' -H 'Origin: http://localhost:3000' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36' -H 'content-type: multipart/form-data; boundary=8fjcuiu0anwdygb9t528w71n0cnmiezfmkgeyqmovquxru3huoazozzx5hfr' -H 'Accept: */*' -H 'Referer: http://localhost:3000/' -H 'Connection: keep-alive' --data-binary $'--8fjcuiu0anwdygb9t528w71n0cnmiezfmkgeyqmovquxru3huoazozzx5hfr\r\nContent-Disposition: file; filename="css.css"\r\nContent-Type: application/octet-stream\r\n\r\n2\r\n--8fjcuiu0anwdygb9t528w71n0cnmiezfmkgeyqmovquxru3huoazozzx5hfr\r\nContent-Disposition: file; filename="html.html"\r\nContent-Type: application/octet-stream\r\n\r\n3\r\n--8fjcuiu0anwdygb9t528w71n0cnmiezfmkgeyqmovquxru3huoazozzx5hfr\r\nContent-Disposition: file; filename="index.html"\r\nContent-Type: application/octet-stream\r\n\r\n\n <!DOCT
~ $ cat .config/fontconfig/fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- Set preferred serif, sans serif, and monospace fonts. -->
<alias>
<family>serif</family>
<prefer>
<family>Source Serif Pro</family>
</prefer>
~/tmp $ npm install -g --prefix /home/travis/tmp/installs http-server
/home/travis/tmp/installs/bin/hs -> /home/travis/tmp/installs/lib/node_modules/http-server/bin/http-server
/home/travis/tmp/installs/bin/http-server -> /home/travis/tmp/installs/lib/node_modules/http-server/bin/http-server
[email protected] /home/travis/tmp/installs/lib/node_modules/http-server
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
db.all("SELECT Id, Name, Long, Size, Price, Supplier, Country, Grape, Vegeterian, Picture FROM wine WHERE Id=" + req.params.id + " ORDER BY Name", function(err, rows) {
var list = [];
rows.forEach(function (row) {
list.push({
id: row.Id,
name: row.Name,
long: row.Long,
size: row.Size,
price: row.Price,
supplier: row.Supplier,
00000000 00 00 00 04 00 00 01 7c 00 00 01 7c 0a 10 81 a0 |.......|...|....|
00000010 91 71 82 22 2a 19 d3 68 ad c8 68 59 36 a2 12 ab |.q."*..h..hY6...|
00000020 02 08 00 12 a6 02 30 82 01 22 30 0d 06 09 2a 86 |......0.."0...*.|
00000030 48 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30 82 |H.............0.|
00000040 01 0a 02 82 01 01 00 b8 c3 cf 9f 59 c5 8b a5 ec |...........Y....|
00000050 0f 76 af bc c4 c0 e3 64 30 aa 26 b9 34 26 a7 56 |.v.....d0.&.4&.V|
00000060 71 c6 84 a6 5d 65 a4 0a 32 3a 7a b6 0d cf 06 13 |q...]e..2:z.....|
00000070 34 f6 04 9a a5 a1 ab 49 93 10 ec 4d 68 87 4d 4a |4......I...Mh.MJ|
00000080 97 30 26 84 3f fc dd 4c d0 8f 2a 18 be 52 1f c2 |.0&.?..L..*..R..|
00000090 71 c5 3b c9 da f8 c6 cc 6f 80 6a a2 ce 4e f5 e5 |q.;.....o.j..N..|
@travisperson
travisperson / readme.md
Last active November 18, 2015 09:12
Double length deliminated

In protocol.go the Propose protobuf is writen using a function called writeMsgCtx. This method accepts a w msgio.Writer

func writeMsgCtx(ctx context.Context, w msgio.Writer, msg proto.Message) ([]byte, error)

The msgio.Writer passed into writeMsgCtx is the s.insecureM writer which is set in the newSecureSession function. s.insecureM is created from a insecure io.ReadWriteCloser. This however, is already a msgio ReadWrite.

~/t/random2 (master) $ git status 10:34:55
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
something