Skip to content

Instantly share code, notes, and snippets.

View vito's full-sized avatar

Alex Suraci vito

  • Toronto, ON
  • 10:01 (UTC -04:00)
View GitHub Profile
@vito
vito / sshttp.go
Created March 28, 2015 22:17
golang ssh+http listener
package main
import (
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"syscall"

Keybase proof

I hereby claim:

  • I am vito on github.
  • I am alexsuraci (https://keybase.io/alexsuraci) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

/*
* CVE-2014-0196: Linux kernel <= v3.15-rc4: raw mode PTY local echo race
* condition
*
* Slightly-less-than-POC privilege escalation exploit
* For kernels >= v3.14-rc1
*
* Matthew Daley <mattd@bugfuzz.com>
*
* Usage:
@vito
vito / go-fmt.vim
Last active December 21, 2015 06:18
automatic go fmt that preserves the user's "undo" (based on http://golang.org/misc/vim/ftplugin/go/fmt.vim)
function! s:GoFormatKeepingUndo()
let view = winsaveview()
silent! undojoin | silent %!gofmt
if v:shell_error
let errors = []
for line in getline(1, line('$'))
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
if !empty(tokens)
call add(errors, {"filename": @%,
\"lnum": tokens[2],
@vito
vito / gist:5298326
Created April 3, 2013 03:53
atomy macro bootstrapping
-- TODO: define 'nil'
-- TODO: define quasiquote code, use for the macro macro
-- TODO: make quasiquote in macro pattern implicit (e.g. macro(~a + ~b): '2)
define-method(
'define-macro
'define-method('expand, body, '_, pattern)
'_
'pattern
'body)
@vito
vito / manifest.yml
Created May 15, 2012 21:34
minecraft as a service
---
applications:
.:
name: minecraft
framework:
name: standalone
info:
mem: 64M
description: Standalone Application
exec:
$ ri add_runtime_dependency
Nothing known about .add_runtime_dependency
$ rbenv shell 1.9.2-p290
$ ri add_runtime_dependency
.add_runtime_dependency
(from gem rubygems-1.8.10)
Implementation from Gem::Specification
------------------------------------------------------------------------------
add_runtime_dependency(gem, *requirements)
@vito
vito / conclusions?
Created March 4, 2011 19:25
quanto method style guidelines
if you have to write a unary method to accompany a keyword method
(e.g. for sending no args), just define the unary method
if you're going to use multiple blocks, use keyword
if a block value is likely to be used, consider using unary postfix or
keyword (not a huge deal though, given that & is pretty easy)
unary prefix can be better for DSLs, as it immediately shows the purpose
of the block rather than tacking it on the end
blah
@vito
vito / gist:784020
Created January 18, 2011 05:26
regex planning
"123-456-hello" case-of: {
/(\d+)-(\d+)-(?<foo>\w+)/ ->
{ \0 print -- prints 123-456-hello
\1 print -- prints 123
foo print -- prints hello (\2 available too?)
} call
}
"123-456-hello" replace: /(\d+)-(?<foo>\w+)/ with: {
foo .. "-" .. \1