Skip to content

Instantly share code, notes, and snippets.

require 'cinch'
require 'open-uri'
require 'nokogiri'
require 'cgi'
require 'json'
require 'pry'
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.mdx.la"
#!/bin/bash
function wipe_it() {
echo "Alright, here we go. ZEROING EVERYTHING"
echo "Yeah right, execute this yourself: sudo dd if=/dev/zero of=/dev/mapper/sick-root bs=1M"
}
function confirm_it() {
read -n1 -p "Are you absolutely SURE you want to zero the drive? (y/n): "
echo
@kfatehi
kfatehi / validate.rb
Created July 26, 2012 10:21
Check known md5sum ubuntu/OSX
#!/usr/bin/env ruby
target = ARGV[0]
known_md5 = "73d2bd14bd37c5877bdc6c1fbfa66dd5"
puts "Checking if #{target} has md5 of #{known_md5}"
prog = !`which md5sum`.empty? ? 'md5sum' : (!`which md5`.empty? ? "md5" : raise)
test_md5 = `#{prog} #{target}`
found = test_md5.match(/#{known_md5}/)
puts "#{prog} reports positive match: #{found ? "YES" : "NO"}"
## Usage:
➜ ~ irb
1.9.3p194 :001 > @args = {"foo"=>2}
=> {"foo"=>2}
1.9.3p194 :002 > :@args
=> :@args
1.9.3p194 :003 > instance_variable_defined?
instance_variable_defined?
1.9.3p194 :003 > instance_variable_defined? :@args
=> true
1.9.3p194 :004 > instance_variable_defined? :@argss
@kfatehi
kfatehi / connect.sh
Created August 2, 2012 14:13
Secure SSH VNC Tunnel Bash/Ruby Script on Mac OS X
#!/bin/bash
TARGET_IP="xx.xx.xx.xx"
TARGET_LOCAL_VNC_PORT=5901
LOCAL_VNC_PORT=31543
TARGET_WAN_SSH_PORT=22345
TARGET_USER="keyvan"
ruby secure_vnc_tunnel.rb $LOCAL_VNC_PORT $TARGET_IP $TARGET_LOCAL_VNC_PORT $TARGET_WAN_SSH_PORT $TARGET_USER
echo "Entering SSH session ($TARGET_IP:$TARGET_WAN_SSH_PORT)"
ssh -p $TARGET_WAN_SSH_PORT $TARGET_USER@$TARGET_IP
@kfatehi
kfatehi / stdout
Created August 22, 2012 09:48
Pry being weird
[4] pry(main)> CocoaDialog.methods - Object.methods
=> [:bubble, :msgbox]
[5] pry(main)> CocoaDialog.methods -Object.methods
NoMethodError: undefined method `-@' for #<Array:0x007f8e0b26f520>
from (pry):4:in `<main>'
[6] pry(main)>
@kfatehi
kfatehi / mdxtopic
Created August 25, 2012 21:34
#mdx topic
11:59 Topic: MiNDYNAMiCS | MOV Format Spec: http://bit.ly/MjTXl8 | Valve Handbook: http://bit.ly/MjTU8S | DUCKY COMMANDS: https://duckduckgo.com/bang.html | COOL BLOG, by jsilver: http://coolbloglala.tumblr.com/
@kfatehi
kfatehi / moaning
Created September 29, 2012 10:09 — forked from anonymous/gist:3803612
jeanre's situation
spec/spec_helper.rb:22:in `block in <top (required)>': uninitialized constant FactoryGirl (NameError)
➜ triangle_lulz ruby triangle.rb
Enter base size
10
Triangle of base size 10:
*
**
***
****
*****
******
# classes im using for this task lol
class SupportAnalyzer
end
class UnsupportedClip
attr_reader :clip, :reasons
def initialize(clip)
@clip = clip
@reasons = []