Skip to content

Instantly share code, notes, and snippets.

@kirkelifson
kirkelifson / cygwin-rvm.md
Last active April 15, 2024 18:01
RVM Install on Windows

Do you have spaces in your Windows username?

  1. Create a new account on Windows without a space.

#Installation

  1. Download cygwin from http://cygwin.com
  2. Run setup-(x86|x86_64).exe
  3. Click next until selecting repo to download packages
  4. Choose http://cs.vt.edu (gotta go fast), click next
@kirkelifson
kirkelifson / pre-push.sh
Last active July 24, 2019 21:07
good git hooks for rails
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
print_fuck() {
echo "${RED}"
echo " █████▒█ ██ ▄████▄ ██ ▄█▀"
echo "▓██ ▒ ██ ▓██▒▒██▀ ▀█ ██▄█▒ "
echo "▒████ ░▓██ ▒██░▒▓█ ▄ ▓███▄░ "
echo "░▓█▒ ░▓▓█ ░██░▒▓▓▄ ▄██▒▓██ █▄ "
@kirkelifson
kirkelifson / rspec-all-day.rb
Last active March 31, 2019 03:45
rspec all day - simple test runner for finding fragile tests
#!/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 / drive_space.rb
Created June 2, 2017 21:55
Reports remaining drive space for each specified drive (Windows)
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 15:38
Knightsec Distraction Channel
<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;
@kirkelifson
kirkelifson / gist:331c833bc3f562319cdd8f74cac235ce
Created March 13, 2017 23:53
bad words according to crown royal
<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 December 1, 2016 02:44
Quick update to signalflare using API v4 wrapper
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 July 10, 2016 14:40
Selects all column names containing phone and not containing type
phones = Model.attribute_names.select { |c| c.include? 'phone' }.reject { |c| c.include? 'type' }.map(&:to_sym)
@kirkelifson
kirkelifson / meta.rb
Created February 20, 2016 05:59
Map relation containing id and model to instances
# 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 January 28, 2016 19:56
Generates a list of params straight from the database schema
#!/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