Skip to content

Instantly share code, notes, and snippets.

View postmodern's full-sized avatar
releasing new versions

Postmodern postmodern

releasing new versions
View GitHub Profile
jaygooby / netblock-from-whois
Last active April 16, 2023 11:08
Gets and caches the netblock owner from `whois` for an IP address
# MIT License
# Copyright (c) 2022 Jay Caines-Gooby, @jaygooby,
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
Papierkorb /
Last active May 25, 2024 08:25
Dynamic library in Crystal

Writing a dynamic library in Crystal, and calling it from C

  • Download all files.
  • Build the Crystal part:
crystal build --release --cross-compile --prelude ./no_main
              ^ You can leave this out
                        ^ We want to link ourselves!
 ^ Use our custom prelude!
VimleshS / ruby_cert.rb
Created August 30, 2016 09:35
Usage examples of ruby’s openssl lib
require 'openssl'
require 'date'
require 'time'
mikhailov / gist:3fd58bd21ecc5f7220cc
Created September 26, 2014 07:49
Set specific Ruby version on CentOS
#/bin/bash -e
if [ "$RUBY_VERSION" == '2.0.0' ]; then
yum -y install ruby20 rubygems20 ruby-devel
alternatives --set ruby /usr/bin/ruby2.0
elif [ "$RUBY_VERSION" == '1.9.3' ]; then
yum -y install ruby19 rubygems19 ruby19-devel
lelandbatey /
Last active June 16, 2024 13:44
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


postmodern / gist:7939687
Last active December 31, 2015 05:19
Experiment to see if OptionParser allows options to define other options. Turns out you can!
require 'optparse'
options ="usage: #{$0}") do |opts|
opts.on('-f','--file FILE','loads a file') do |file|
puts "loading file #{file}"
opts.separator "#{file} options:"
opts.on('-c','--custom') do
puts "custom option defined by file #{file}"
postmodern /
Last active January 11, 2024 15:37
Crypto Privacy Copy Pasta
emonti / llvm_disassembler.rb
Last active October 13, 2015 02:08
Multi-arch bytecode disassembler using libLLVM
#!/usr/bin/env ruby
# author eric monti ~ nov 20, 2012
# license: DWTFYW
require 'rubygems'
require 'ffi'
class LLVMDisassembler
module C
extend FFI::Library
ffi_lib ['LLVM', 'LLVM-3.2svn', 'LLVM-3.1', 'LLVM-3.0']
willglynn /
Created October 4, 2012 02:01
.gemsig Proposal

.gemsig Proposal has little in the way of defenses against tampering. Right now, new gems could be uploaded to S3 and distributed to users worldwide without detection, and the only thing preventing this is the security of the AWS credentials presently stored on world-facing web servers. S3 Versioning is a step that could be taken immediately to reduce the severity of compromise, but a larger solution is required.

This document proposes a .gemsig file as a means of verifying that a gem has not been modified during distribution. This file would be distributed alongside the .gem files, allowing clients to verify authenticity.


cktricky / proc-it-like-its-hawt
Created September 30, 2012 01:33
Cool proc-ness
#!/usr/bin/env ruby
require 'celluloid'
require 'net/http'
class Fetcher
include Celluloid
def get(action, url)
puts "doing work.."
res =