Skip to content

Instantly share code, notes, and snippets.

@budnik
budnik / gnome-terminal.css
Last active January 26, 2021 03:08
Gnome terminal CSS for ambiance theme
/* gnome-terminal */
TerminalScreen {
-TerminalScreen-background-darkness: 0.95;
background-color: #300a24;
color: #fff;
}
TerminalWindow,
TerminalWindow.background {
background-image: none;
class LocaleController < ApplicationController
respond_to :json
caches_page :show, :gzip => :best_compression
def show
expires_in 1.year
respond_with YAML::load File.open File.join Rails.root, %W[config locales #{params[:id]}.yml]
end
end
class FooBarController < ApplicationController
##
##This unscoping works:
def index
Campaign.unscoped do
Advertiser.unscoped do
@invoices = Invoice.all :include => [:campaign, :advertiser]
end
end
respond_to do |format|
@budnik
budnik / service
Last active December 15, 2015 09:09 — forked from brentkirby/service
#!/bin/bash -e
#
# Since unicorn creates a new pid on restart/reload, it needs a little extra love to
# manage with runit. Instead of managing unicorn directly, we simply trap signal calls
# to the service and redirect them to unicorn directly.
#
# To make this work properly with RVM, you should create a wrapper for the app's gemset unicorn.
#
function is_unicorn_alive {
@budnik
budnik / gotcha2.rb
Last active December 15, 2015 17:49
class Acme
attr_accessor :a, :b
def initialize
@a=[]
@b=[]
end
def foo!
a<<5
self
@budnik
budnik / sumblime disable menu
Last active December 19, 2015 15:09
On my saucy crouton sublime menu looks ugly. This is how I disable it.
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=env GTK_MODULES=globalmenu-gtk /opt/sublime_text/sublime_text %F
Icon=/opt/sublime_text/Icon/256x256/sublime-text.png
Terminal=false
MimeType=text/plain;
@budnik
budnik / intersect_geoip_CSVs.rb
Last active December 29, 2015 16:38
generates N data sets like: [[1,2],[3,4] .. [M-1,M]] and calculates intersection. accepts two integer arguments N, M defaults is 3 and 100
#!/usr/bin/env ruby
require 'csv'
require 'ipaddr'
# Formating:
ff = ->() {
f = ->(a) {a.take(2).map(&IPAddr.method(:new)).map(&:to_i) rescue a.take(2).map(&:to_i) }
f[CSV.parse(self.peek).first]
}
alias subl="/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"
if [[ ! -z $SSH_AGENT_PID ]] && `kill -0 $SSH_AGENT_PID` && [[ -f $SSH_AUTH_SOCK ]]
then
echo -e "\e[33m ☀ SSH agent already set up!"
else
eval `ssh-agent.exe`
ssh-add ~/.ssh/id_rsa
conemuc //EXPORT SSH_AUTH_SOCK SSH_AGENT_PID
fi
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
/*
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
@budnik
budnik / quiz2.rb
Created February 12, 2014 07:52 — forked from fxposter/quiz2.rb
def check
yield
rescue => e
e
end
check { "hello, #{1}" } # ?
check { "hello, " + 1 } # ?
check { "hello, " << 1 } # ?