Skip to content

Instantly share code, notes, and snippets.

@kirkelifson
kirkelifson / rspec-all-day.rb
Last active Mar 31, 2019
rspec all day - simple test runner for finding fragile tests
View rspec-all-day.rb
#!/usr/bin/env ruby
require 'json'
require 'awesome_print'
require 'colorize'
class SpecRunner
FILE_NAME = "spec_run_#{Time.now.strftime("%H%M%S_%m%d%y_%Z")}.log"
TEST_LOG_FILE = 'log/test.log'.freeze
LOG_FILE_SIZE_LIMIT = 500
@kirkelifson
kirkelifson / pre-push.sh
Last active Jul 2, 2018
good git hooks for rails
View pre-push.sh
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
print_fuck() {
echo "${RED}"
echo " █████▒█ ██ ▄████▄ ██ ▄█▀"
echo "▓██ ▒ ██ ▓██▒▒██▀ ▀█ ██▄█▒ "
echo "▒████ ░▓██ ▒██░▒▓█ ▄ ▓███▄░ "
echo "░▓█▒ ░▓▓█ ░██░▒▓▓▄ ▄██▒▓██ █▄ "
@kirkelifson
kirkelifson / drive_space.rb
Created Jun 2, 2017
Reports remaining drive space for each specified drive (Windows)
View drive_space.rb
require 'filesize'
require 'win32ole'
drive_list = ["D:", "H:"]
file_system = WIN32OLE.new("Scripting.FileSystemObject")
drives = file_system.Drives
drives.each do |drive|
next unless drive_list.include? drive.Path
file = File.open("#{drive.Path}//drive_status.txt", "w")
@kirkelifson
kirkelifson / distraction.html
Created May 3, 2017
Knightsec Distraction Channel
View distraction.html
<meta charset="UTF-8"><title>Knightsec™ Distraction Channel</title>
<style>
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}
#watermark
{
position:fixed;
bottom:8%;
right:8%;
opacity:0.5;
View gist:331c833bc3f562319cdd8f74cac235ce
<input type="hidden" id="bad_words_list" class="input-text" value="absofuckinlutely,ahole,badass,anus,arse,a55,as5,a5s,arsehole,ash0les,asholes,ass,asss,a$$$,a$$,assbag,assbandit,biiiach,biiach,assbanger,assbite,assclown,asscock,asscracker,asses,peckerhead,pussy,fucckk,gay,fuucckk,fucckkk,fucck,nigguh,hairydick,dickhead,niggah,assface,assfuck,assfucker,assgoblin,sh!t,assh0le,assh0lez,fuc,fuk,asshat,ass-hat,nigga,niga,asshead,dick beaters,b1tch,motherfucker,fagit,asshole,assholes,assholz,asshopper,ass-jabber,assjacker,fkkin,fkkn,asslick,asslicker,assmonkey,assmunch,assmuncher,assnigger,nigger,asspirate,ass-pirate,assshit,assshole,asssucker,asswad,asswipe,azzhole,bampot,bassterds,bastard,bastards,bastardz,basterds,basterdz,beaner,biatch,biotch,bitch,bitchass,bitches,bitchs,bitchtits,bitchy,blowjob,blowjob,blowjobs,boffing,recktum,rectum,renob,retard,rimjob,ruski,cunt, cunts,cock,sadist,sandnigger,sandnigger,scank,schlong,screwing,scrote,scrotum,seamen,semen,sex,sexual,sexualtoy,sexuallypopularwoman,sh1ter,sh1ts
@kirkelifson
kirkelifson / signalflare-update.rb
Last active Dec 1, 2016
Quick update to signalflare using API v4 wrapper
View signalflare-update.rb
require 'rubyflare'
ip = { content: `curl -s https://ifconfig.co`.chomp }
zone_name = "parodybit.net"
hostnames = ['host1.parodybit.net', 'host2.parodybit.net', 'host3.parodybit.net']
email = 'EMAIL-HERE'
api_key = 'API-KEY-HERE'
cloudflare = Rubyflare.connect_with(email, api_key)
zone_id = cloudflare.get('zones').results.select{ |z| z[:name] == zone_name }.first[:id]
@kirkelifson
kirkelifson / select_columns.rb
Created Jul 10, 2016
Selects all column names containing phone and not containing type
View select_columns.rb
phones = Model.attribute_names.select { |c| c.include? 'phone' }.reject { |c| c.include? 'type' }.map(&:to_sym)
@kirkelifson
kirkelifson / meta.rb
Created Feb 20, 2016
Map relation containing id and model to instances
View meta.rb
# Example:
# approvable_id = 7
# approval_type = "Finding"
# Finding.find(7) is yielded
Approval.pluck(:approvable_id, :approvable_type).sort.uniq.map { |id, type| Object.const_get(type).find(id) }.count
@kirkelifson
kirkelifson / generate_params.rb
Created Jan 28, 2016
Generates a list of params straight from the database schema
View generate_params.rb
#!/usr/bin/env ruby
# Usage: generate_params.rb [/path/to/db/schema.rb] [table name]
# By: Kirk Elifson <kirk [at] parodybit [dot] net>
def print_usage
puts "", "\tUsage: ruby generate_params.rb /path/to/db/schema.rb table_name", ""
exit
end
print_usage if ARGV.length != 2
View resume.tex
% Document settings
% ===
\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{green}
\usepackage{ulem}
\usepackage[top=12mm,left=12mm,right=12mm,bottom=12mm]{geometry}
% Header
% ===
You can’t perform that action at this time.