Skip to content

Instantly share code, notes, and snippets.

View PatrickTulskie's full-sized avatar

Patrick Tulskie PatrickTulskie

View GitHub Profile
@PatrickTulskie
PatrickTulskie / brute.rb
Created August 13, 2023 00:28
Brute Forcing for vapi
require 'net/http'
require 'json'
require 'csv'
require 'thread'
hostname = "localhost"
url = URI('http://#{hostname}/vapi/api2/user/login')
mutex = Mutex.new
# Thread pool size
@PatrickTulskie
PatrickTulskie / randrm
Created June 26, 2019 17:03
Randomly delete files from a directory
#!/usr/bin/env ruby
puts "Gimme a directory" and exit if ARGV.first.nil?
directory = Dir.new(File.expand_path(ARGV.first))
directory.each do |file|
next if %w(. ..).include?(file)
if rand(2) == 1
puts "Deleting #{file}"

Keybase proof

I hereby claim:

  • I am patricktulskie on github.
  • I am ptulskie (https://keybase.io/ptulskie) on keybase.
  • I have a public key ASBCrp2eBktiU8omJ-YOzS9aL7sCNSigNY4Qrsl1Vu20nwo

To claim this, I am signing this object:

@PatrickTulskie
PatrickTulskie / lita_config.rb
Last active March 3, 2017 20:19
VictorOps Handler for Lita
Lita.configure do |config|
# ...
config.handlers.victor_ops.api_id = "API_ID"
config.handlers.victor_ops.api_key = "API_KEY"
end
@PatrickTulskie
PatrickTulskie / pool.rb
Created February 10, 2017 17:48
Quick and dirty thread pool
class Pool
attr_accessor :size, :jobs
def initialize(size: 6)
@size = size
@jobs = Queue.new
@pool = Array.new(@size) do |i|
spawn_thread(i)
end
class Parent
def derp
puts "Parent Derp"
end
end
class Child < Parent
@PatrickTulskie
PatrickTulskie / new.rb
Last active August 30, 2018 06:19
New new new new new
class New
def new
self.class
end
def to_s
'new'
end
end
@PatrickTulskie
PatrickTulskie / shotgun_sort.rb
Created November 19, 2014 20:35
Shotgun sort in Ruby
class Array
def shotgun_sort
sorted = false
arry = self.dup
iteration = 0
while !sorted do
puts "Attempt #{iteration += 1}" if $debug
arry.shuffle!
sorted = arry.each_cons(2).all? { |a, b| (a <=> b) <= 0 }
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@PatrickTulskie
PatrickTulskie / debug.log
Created October 24, 2013 15:11
More RVM debug
:~ patrick$ rvm --debug install ree
ree - install
Searching for binary rubies, this might take some time.
Remote file does not exist https://rvm.io/binaries/osx/10.9/x86_64/ree-1.8.7-2012.02.tar.bz2
Remote file does not exist http://jruby.org.s3.amazonaws.com/downloads/ree-1.8.7-2012.02.tar.bz2
Remote file does not exist http://binaries.rubini.us/osx/10.9/x86_64/ree-1.8.7-2012.02.tar.bz2
rvm_remote_server_url3 not found
No remote file name found
No binary rubies available for: osx/10.9/x86_64/ree-1.8.7-2012.02.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.