Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am elomatreb on github.
  • I am elomatreb (https://keybase.io/elomatreb) on keybase.
  • I have a public key whose fingerprint is 74E0 B317 4A43 53FF D86E 7EAF 5AE6 943A 31E3 6AEC

To claim this, I am signing this object:

@elomatreb
elomatreb / .htaccess
Created July 26, 2014 16:24
Allow .html extension for .php files
# Allow .html extension for .php files.
# AllowOverride needs to be set to 'All'
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html$ $1.php
@elomatreb
elomatreb / practice.cfg
Created September 5, 2015 18:36
CSGO practice server settings
sv_cheats 1
mp_maxmoney 50000
mp_startmoney 50000
mp_freezetime 1
mp_roundtime_defuse 60
mp_buy_anywhere 1
mp_buytime 3600
bot_kick
sv_infinite_ammo 2
sv_showimpacts 1
@elomatreb
elomatreb / inspectjwt.rb
Created January 29, 2016 13:25
Inspect a JSON Web Token's payload. THIS DOES NOT DO *ANY* VALIDATION!
#!/usr/bin/env ruby
# Usage: inspectjwt.rb <token>
require "time"
require "json"
require "base64"
TOKEN = ARGV[0]
@elomatreb
elomatreb / OwnedModelTrait.php
Created February 14, 2016 19:04
A simple trait for Eloquent models that provides convenience filters and methods for checking ownership
<?php
namespace App\Traits;
use App\User;
/**
* A model that is owned by a user
*/
trait OwnedModelTrait
@elomatreb
elomatreb / terminalrc
Last active February 14, 2016 19:09
xfce4-terminal
[Configuration]
MiscAlwaysShowTabs=FALSE
MiscBell=FALSE
MiscBordersDefault=TRUE
MiscCursorBlinks=TRUE
MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
MiscDefaultGeometry=80x24
MiscInheritGeometry=FALSE
MiscMenubarDefault=FALSE
MiscMouseAutohide=FALSE
@elomatreb
elomatreb / .gitconfig
Last active August 19, 2016 17:29
global git config stuff
[user]
name = "Ole B."
email = git@bertr.am
signingkey = E82FD8D2E1F55FD5
[core]
editor = nano
excludesfile = ~/.gitignore_global
[color]
ui = true
[format]
[378849.675552] usb 2-1: new high-speed USB device number 9 using ehci-pci
[378851.392233] usb 2-1: new high-speed USB device number 10 using ehci-pci
[378852.849039] usb_storage: disagrees about version of symbol kmem_cache_alloc_trace
[378852.849042] usb_storage: Unknown symbol kmem_cache_alloc_trace (err -22)
[378852.849059] usb_storage: disagrees about version of symbol wake_up_process
[378852.849060] usb_storage: Unknown symbol wake_up_process (err -22)
[378852.849360] usb_storage: disagrees about version of symbol kmalloc_caches
[378852.849361] usb_storage: Unknown symbol kmalloc_caches (err -22)
[378852.867154] usb_storage: disagrees about version of symbol kmem_cache_alloc_trace
[378852.867156] usb_storage: Unknown symbol kmem_cache_alloc_trace (err -22)
@elomatreb
elomatreb / bitmask.rb
Created March 22, 2017 08:47
Ruby utility for parsing bitmask options.
# Usage:
# Bitmask[:list, :of, :option, :keys, value]
# where the last key in the list will be represented by the least significant
# bit in value.
#
# Example:
# Bitmask[:optionA, nil, :optionB, :optionC, 0b1010]
# #=> {:optionA=>true, :optionB=>true, :optionC=>false}
# Use nils to indicate bits that do not have a meaning.
class Bitmask
@elomatreb
elomatreb / css_matchers.rb
Created July 17, 2017 11:51
Duct-tape HTML testing. No capybaras were required and/or harmed during development
require "nokogiri"
RSpec::Matchers.define :have_elements_matching do |selector|
match do |view|
Nokogiri::HTML(view).match(selector).any?
end
end
RSpec::Matchers.define :have_one_element_matching do |selector|
match do |view|