I hereby claim:
- I am suneil on github.
- I am menghao (https://keybase.io/menghao) on keybase.
- I have a public key ASBEWUxPMfCB8Z4RAWl8txDLqtdOzN4OXF3ga-vNIsW56go
To claim this, I am signing this object:
| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| ) | |
| // In order to understand how protocol buffers delineates serialized fields I wrote this | |
| // to explore the marshalling/unmarshalling code. This still requires some understanding | |
| // of bit arithmetic, however, this will make it easier to see how it works. In order to go |
I hereby claim:
To claim this, I am signing this object:
| var child_process = require('child_process'); | |
| exports.handler = function(event, context) { | |
| var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' }); | |
| proc.on('close', function(code){ | |
| if(code !== 0) { | |
| return context.done(new Error("Process exited with non-zero status code")); | |
| } |
| { | |
| "cmd": ["/usr/bin/env", "php", "$file"], | |
| "file_regex": "^(...*?):([0-9]*):?([0-9]*)", | |
| "selector": "source.php" | |
| } |
| #!/usr/bin/env python | |
| import os, sys, re, envoy | |
| top = 'directory-to-process' | |
| for root, subs, files in os.walk(top): | |
| if '.svn' in root: | |
| continue |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| <?php | |
| // works in php 5.4 only (JSON_PRETTY_PRINT for json_encode is a 5.4 feature) | |
| $json = ''; | |
| if (isset($_POST['json_text']) && !empty($_POST['json_text'])) { | |
| $struct = json_decode($_POST['json_text'], true); | |
| $json = json_encode($struct, JSON_PRETTY_PRINT); | |
| header('Content-Type: text/plain'); | |
| echo $json; | |
| exit; |
| import os | |
| dir = '.' | |
| for f in os.listdir(dir): | |
| path = os.path.join(dir, f) | |
| old_link = os.readlink(path) | |
| new_link = old_link.replace('Trunk', 'Branches/<version>') | |
| os.unlink(path) | |
| os.symlink(new_link, path) |