Skip to content

Instantly share code, notes, and snippets.

Postmodern postmodern

Block or report user

Report or block postmodern

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
@postmodern
postmodern / resolv_weirdness.rb
Last active Oct 10, 2017
Resolv::DNS weirdness
View resolv_weirdness.rb
require 'resolv'
puts "Normal behavior:"
dns = Resolv::DNS.new
p dns.getaddresses('twitter.com')
# => [#<Resolv::IPv4 104.244.42.1>, #<Resolv::IPv4 104.244.42.193>]
puts "With search: option:"
dns = Resolv::DNS.new(search: ['.'])
p dns.getaddresses('twitter.com')
View catted.log
$ cat test.rb | \irb
Switch to inspect mode.
true if 0...1
(irb):1: warning: integer literal in conditional range
(irb):1: warning: integer literal in conditional range
nil
true if 1..2
(irb):2: warning: integer literal in conditional range
(irb):2: warning: integer literal in conditional range
nil
@postmodern
postmodern / tcp_client.rs
Last active Jul 23, 2019
TCP Client in Rust
View tcp_client.rs
#![allow(unused_variables)]
#![allow(unused_imports)]
use std::env;
use std::process;
use std::thread;
use std::io::{self, Read, Write, Error};
use std::net::TcpStream;
use std::net::TcpListener;
View ili9341.c
#include "ili9341.h"
volatile uint16_t LCD_W=ILI9341_TFTWIDTH;
volatile uint16_t LCD_H=ILI9341_TFTHEIGHT;
void ili9341_hard_init(void)//init hardware
{
rstddr=0xFF;//output for reset
rstport |=(1<<rst);//pull high for normal operation
controlddr|=(1<<dc);//D/C as output
@postmodern
postmodern / rip_dvd
Last active Jun 5, 2019
Script to automate ripping DVDs using Handbrake-CLI and mkvmerge
View rip_dvd
#!/usr/bin/env bash
#
# Author: postmodern
# Description:
# Rips a DVD to a H.264 MKV file, with chapters and tags. Ignores any
# bad blocks or sectors on the DVD.
# Dependencies:
# * gddrescue
# * handbrake-cli
# * mkvtoolnix
@postmodern
postmodern / git_file_filter.sh
Last active Mar 27, 2019
A `git filter-branch` script for extracting arbitrary files in a repo.
View git_file_filter.sh
#!/bin/bash
#
# usage: git filter-branch --force --prune-empty --index-filter "$(cat git_file_filter.sh)" --tag-name-filter cat -- --all
#
shopt -s globstar
whitelist=(
# files and globs go here
)
@postmodern
postmodern / gist:7939687
Last active Dec 31, 2015
Experiment to see if OptionParser allows options to define other options. Turns out you can!
View gist:7939687
require 'optparse'
options = OptionParser.new("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}"
end
@postmodern
postmodern / gist:6912812
Last active Dec 25, 2015
Example of using Curses to manage input/output text areas.
View gist:6912812
require 'curses'
Curses.init_screen
output = Curses::Window.new(Curses.lines - 1, Curses.cols, 0, 0)
output.setpos(0,0)
input = Curses::Window.new(1, Curses.cols, Curses.lines - 1, 0)
input.setpos(0,0)
loop do
@postmodern
postmodern / gist:6877205
Last active Dec 24, 2015
Steps to Reproduce the rubinius 2.0.0 rubysl/bundler issue
View gist:6877205

Steps to Reproduce

  1. mkdir test_rubysl && cd test_rubysl
  2. echo "source 'https://rubygems.org/'" > Gemfile
  3. bundle install
  4. echo "p require 'bigdecimal'" > test.rb
  5. bundle exec ruby test.rb

Expected Result

@postmodern
postmodern / exploit.rb
Created Jun 16, 2013
Boilerplate code for the linked challenge, Defcon CTF 2013. Enjoy
View exploit.rb
#!/usr/bin/env ruby
require 'ronin/support'
require 'ronin/asm'
include Ronin::Network::TCP
payload = Ronin::ASM::Shellcode.new do
mov 0xaaaaaaaa, eax
ret
You can’t perform that action at this time.