Skip to content

Instantly share code, notes, and snippets.

View sixtyfive's full-sized avatar
🐯
Rawrrr.

J. R. Schmid sixtyfive

🐯
Rawrrr.
View GitHub Profile
@sixtyfive
sixtyfive / config_initializers_locale.rb
Created May 29, 2016 23:55
Didn't love this all that much, but perhaps it'll get useful again some day...
require 'i18n/backend/active_record'
# https://github.com/svenfuchs/i18n-active_record
if Translation.table_exists?
# Translation = I18n::Backend::ActiveRecord::Translation # Breaks Ransack :-(
I18n.backend = I18n::Backend::ActiveRecord.new
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
@sixtyfive
sixtyfive / collect_translations.rake
Created May 29, 2016 23:53
I loved this code. Unfortunately I can't use it anymore. May it rest in peace here.
require 'fileutils'
namespace :i18n do
desc 'collect all translation keys from Ruby/HAML files and fill translations table with them'
task :collect_translations => :environment do
def each_translation_key
return to_enum(__method__) unless block_given? # Make this method into an enumerator.
Dir.glob(Rails.root.join('app', '**', '*.{rb,haml}')) do |path| # Rails.root is a Pathname!
File.read(path).scan(/_\(['"](.*?)['"]\)/) do |result| # Because of the (.*) group,
# encoding: UTF-8
require 'active_record/base'
require 'active_record/connection_adapters/sqlite_adapter'
module ActiveRecord::Arabic
# List of Unicode characters taken from Houssam Salem's Anki plugin serving the same purpose.
# (https://github.com/ntsp/anki-addons/blob/master/strip_arabic_diacritics.py)
# They are documented in http://www.unicode.org/charts/PDF/U0600.pdf.
DIACRITICS = [
(['', 'foo', '', 'bar', ''].map {|a| a.blank? ? nil : a}).compact.join('_')
@sixtyfive
sixtyfive / .Xresources
Last active January 29, 2023 22:37
Sensible, readable, good rxvt-unicode configuration.
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
URxvt.depth: 32
URxvt.loginShell: true
URxvt.geometry: 125x40
URxvt.iconFile: /usr/share/icons/Adwaita/256x256/apps/utilities-terminal.png
URxvt.allow_bold: false
@sixtyfive
sixtyfive / cult_of_ignorance.md
Last active November 16, 2020 15:45 — forked from conspect/cult_of_ignorance.md
A Cult Of Ignorance, Isaac Asimov

It's hard to quarrel with that ancient justification of the free press: "America's right to know." It seems almost cruel to ask, ingeniously, "America's right to know what, please? Science? Mathematics? Economics? Foreign languages?"

None of those things, of course. In fact, one might well suppose that the popular feeling is that Americans are a lot better off without any of that tripe.

There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way throughout political and cultural life, nurtured by the false notion that democracy means that "my ignorance is just as good as your knowledge."

Politicians have routinely striven to speak the language of Shakespeare and Milton as ungrammaticaly as possible in order to avoid offending their audiences by appearing to have gone to school. Thus, Adlai Stevenson, who incautiously allowed intelligence and learning and wit to peep out of his speeches, found the American people

@sixtyfive
sixtyfive / .ratpoisonrc
Last active October 3, 2015 19:55
My Ratpoison configuration, may it serve someone!
# Key bindings
escape s-x
definekey top XF86AudioLowerVolume exec volume down 5
definekey top XF86AudioRaiseVolume exec volume up 5
definekey top XF86AudioMute exec volume mute
definekey top s-l exec slock
definekey top s-c exec dmenu_run -nb white -nf black -sb black -sf white
definekey top s-w exec windows
bind w exec windows
#!/usr/bin/env ruby
require 'sorting/convenience'
unless ARGV.length > 1
puts "Usage: ./count_words.rb <corpus file> <word frequency file>"
exit
end
corpus_file = ARGV[0]
config interface 'lan'
option force_link '1'
option type 'bridge'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '10.0.0.254'
option _orig_ifname 'eth0.1 radio0.network1 wlan1'
option _orig_bridge 'true'
option gateway '192.168.0.1'
option dns '141.1.1.1 83.169.185.161 208.67.222.222 8.8.8.8'
config wifi-device radio0
option type mac80211
option channel 11
option hwmode 11g
option path 'pci0000:00/0000:00:11.0'
option htmode HT20
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1
config wifi-iface