Skip to content

Instantly share code, notes, and snippets.

Ben Nagy bnagy

Block or report user

Report or block bnagy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bnagy
bnagy / foo.h
Last active Aug 29, 2015
buildmode c-shared
View foo.h
/* Created by "go tool cgo" - DO NOT EDIT. */
/* package github.com/bnagy/cshared */
/* Start of preamble from import "C" comments. */
/* End of preamble from import "C" comments. */
View gist:b2b7670714ae35f5eac3
# Abstract access to internal files in docx format. Right now this uses system
# zip and tempfiles because the available ruby zip libraries don't seem to be
# able to produce files that Word will read.
#
# Author: Ben Nagy
# Copyright: Copyright (c) Ben Nagy, 2006-2013.
# License: The MIT License
# (See http://www.opensource.org/licenses/mit-license.php for details.)
require 'tempfile'
@bnagy
bnagy / server.rb
Last active Aug 29, 2015
openssl issue
View server.rb
require 'openssl'
require 'socket'
# client.rb - minimal SSL client
# require 'openssl'
# require 'socket'
# include OpenSSL::SSL
# HOST = '::1'
@bnagy
bnagy / srv2.rb
Created Oct 2, 2014
openssl issue
View srv2.rb
require 'openssl'
require 'socket'
# client.rb - minimal SSL client
# require 'openssl'
# require 'socket'
# include OpenSSL::SSL
# HOST = '::1'
View gootool.go
package main
import (
"bytes"
"container/list"
"debug/macho"
"encoding/hex"
"flag"
"fmt"
cs "github.com/bnagy/gapstone"
View extension_map.rb
class ArcFile
include Enumerable
def initialize( input_stream )
@handle=input_stream
end
def each
return self.to_enum unless block_given?
View extension_map.rb
ARGF.each_line {|line|
begin
warn "Starting work on #{line.chomp}"
# expect a line like this:
# s3://commoncrawl-crawl-002/2010/09/24/9/1285380159663_9.arc.gz
proto,unused,bucket_name,*rest=line.chomp.split File::SEPARATOR
raise ArgumentError, "#{__FILE__}: Unknown S3 Protocol #{proto}" unless proto=~/^s3/
object_name=File.join rest
size=Integer( s3.buckets[bucket_name].objects[object_name].content_length )
warn "Reading from #{bucket_name.inspect}, #{object_name.inspect}, size #{size}"
View ntstatus.rb
NTSTATUS_ERRORS = {
'STATUS_SUCCESS' => "0x00000000",
'STATUS_SEVERITY_SUCCESS' => "0x00000000",
'STATUS_SEVERITY_INFORMATIONAL' => "0x00000001",
'STATUS_SEVERITY_WARNING' => "0x00000002",
'STATUS_SEVERITY_ERROR' => "0x00000003",
'STATUS_WAIT_0' => "0x00000000",
'STATUS_WAIT_1' => "0x00000001",
'STATUS_WAIT_2' => "0x00000002",
'STATUS_WAIT_3' => "0x00000003",
View gist:5175611
class Player
def initialize(name, health=100)
@name = name.capitalize
@health = health
end
def say_hello
puts "I'm #{@name} with a health of #{@health}."
end
View wintypes.rb
# This is mainly so that the rest of the code will appear consistent with
# Windows documentation, and allows me to quickly prototype new APIs by copying
# directly from MSDN.
#
# Author: Ben Nagy
# Copyright: Copyright (c) Ben Nagy, 2006-2012.
# License: The MIT License
# (See http://www.opensource.org/licenses/mit-license.php for details.)
require 'ffi'
You can’t perform that action at this time.