Skip to content

Instantly share code, notes, and snippets.

View mfilej's full-sized avatar

Miha Filej mfilej

View GitHub Profile
@mfilej
mfilej / bashrc
Created October 3, 2013 20:55
/etc/bashrc and /etc/profile from a fresh OS X 10.8.5 install
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
@mfilej
mfilej / 1_instructions.md
Last active December 21, 2015 04:48
Automate downloading bank statements from Abanet
  1. Log in to Abanet from your default browser
  2. Izpiski in obvestila → Izpisek poslovnega računa
  3. Napredno iskanje
  4. Pick dates → Prikaži
  5. Open JS console, enter: $("a[href*=#data]")
  6. Copy the output (see example_output.txt)
  7. Run the script: pbpaste | ruby abanet.rb | xargs open
  8. Sit back and wait for your browser to start downloading (you might want to set a separate downloads folder first)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'pg'
@mfilej
mfilej / db_terminate_backend.rake
Created July 7, 2013 11:02
Rake task to terminate idle postgresql connections that prevent a database to be dropped
# http://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection
namespace :db do
desc "Fix 'database is being accessed by other users'"
task :terminate => :environment do
ActiveRecord::Base.connection.execute <<-SQL
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
require "spec_helper"
describe Api::ArtistsController do
let(:artist) { double :artist, id: '1', to_json: '' }
describe "#show" do
it "renders the json representation of a given artist" do
Artist.stub(:find).with('1') { artist }
@mfilej
mfilej / autoexec.cfg.txt
Last active December 17, 2015 21:49
Dota 2 config
con_enable 1
dota_minimap_hero_size "850"
mat_queue_mode 4
fps_max "80"
net_graphproportionalfont 0
net_graphinsettop 145
net_graphinsetright -25
@mfilej
mfilej / Readme.md
Last active November 5, 2021 09:16
RSpec hook to show current spec in process name

Our suite would sometimes randomly hang when running a certain spec, but we weren't able to tell which one. With the below RSpec around filter you can see the spec that is currently running by inspecting the process name.

$ rspec spec_spec.rb &
[2] 64968
$ ps | grep rspec
64968 ttys005    0:00.24 rspec /Users/miha/spec_spec.rb:10 "Dummy spec waits for 100 seconds"
Thanks for joining us, fair wizard! We've received your Paradox Account details, and work has already begun on your new robe. You're about a 38 regular, right?
While we're finishing up the tailoring and applying the flame retardant, we just need you to do us one quick favor and confirm your account. Sometimes it's hard to tell who's who under those robes, so we just want to make sure it's you, and not a vampire. Please confirm your new account by clicking here:
@mfilej
mfilej / screengrab_to_dropbox.rb
Created March 3, 2013 14:59
A ruby script that allows you to take a screenshot and pushes it to dropbox. Use <space> when grabbing to switch between window and area modes.
DROPBOX_DIR = "~/Dropbox/Public/pic"
DROPBOX_URL = "https://dl.dropbox.com/u/4381416/pic/"
filename = Time.now.strftime "grab-%Y%m%d-%H%M%S%4N.png"
target = File.expand_path File.join(DROPBOX_DIR, filename)
public_url = DROPBOX_URL + filename
abort "File already exists" if File.exists?(target)
def screencapture(target)
system "screencapture", "-i", target
@mfilej
mfilej / autoexec.cfg.txt
Last active October 10, 2015 17:57
dota 2 net graph positioning on a crappy 1024x768 resolution
con_enable "1"
net_graphheight 64
net_graphpos 1
net_graphproportionalfont 0
net_graphtext 1
net_graphinsetleft 145
net_graphinsetbottom 0
net_graphinsetright 0
net_graphinsettop -422