Skip to content

Instantly share code, notes, and snippets.

View chesterbr's full-sized avatar
👾

Carlos Duarte Do Nascimento (Chester) chesterbr

👾
View GitHub Profile
@chesterbr
chesterbr / vacuum_firefox_mac.sh
Created May 8, 2012 15:55
Script that cleans up Firefox data files on Mac OS X, useful for "old" installs that get slower with time. I used Automator.app to make it run when I login, so whenever I reboot the computer I get a fresh, snappier Firefox!
#!/bin/bash
# Closes any running Firefox (you'd better close it manually,
# but this is a safeguard)
killall firefox
# Defragments all databases. A few will result in "Error: file
# is encrypted or is not a database". It's fine, they will be
# skipped and no harm will be done.
for f in ~/Library/Application\ Support/Firefox/Profiles/*/*.sqlite; do sqlite3 "$f" 'VACUUM;'; done
@chesterbr
chesterbr / lolcommitify.rb
Created February 28, 2013 20:29
Quick, hack-y script to add lolcommits hooks to all repos in a dir.
#!/usr/bin/env ruby
#
# lolcommitify.rb - adds the post-commit hook of https://github.com/mroth/lolcommits
# to every single git repository on a directory, recursively
#
# Copyright 2013 Chester ([email protected]), BSD-style copyright and disclaimer apply
# (http://opensource.org/licenses/bsd-license.php)
require 'fileutils'
@chesterbr
chesterbr / hello.asm
Last active June 18, 2024 02:34
An Atari 2600 "Hello, World!" program(it indeed prints "HELLO WORLD" vertically, twice)
;
; hello.asm
;
; A "Hello, World!" which illustrates an Atari 2600 programming
; introduction talk (slides at http://slideshare.net/chesterbr).
;
; This is free software (see license below). Build it with DASM
; (http://dasm-dillon.sourceforge.net/), by running:
;
; dasm hello.asm -ohello.bin -f3
@chesterbr
chesterbr / some_class_spec.rb
Created October 3, 2013 15:59
Get the described instance method name(as long as it follows the `describe '#method_name'` convention) in RSpec from within a shared spec, so it can call the method regardless of what it is. Useful when different methods share the same behavior (as an alternative to a block or paramter with the method name)
describe SomeClass do
shared_examples_for 'a nice method' do
let(:method) { example.metadata[:example_group][:example_group][:description].gsub /\#/,'' }
it 'should do nice things' do
...
# This will call subject.foo_method or subject.bar_method, according to context
subject.send(method)
...
end
@chesterbr
chesterbr / gist:10067766
Created April 7, 2014 22:17
keybase.md
### Keybase proof
I hereby claim:
* I am chesterbr on github.
* I am chesterbr (https://keybase.io/chesterbr) on keybase.
* I have a public key whose fingerprint is B26F 1A11 370A CB21 35B5 6469 1B8A C8B8 3B04 9C92
To claim this, I am signing this object:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAmB0lJnHS43/9rBCdT3gBNtq7h7cw9ie26b7CNK9C7qiyo9z2gwGPnYRD+/cPZ72eHX9e8fWxDJ6CS0QxXIga0WUwJLDlDYGEZDXU6pc0KPEilZ8SIXUhD2FVwZilB62fw9eEOY3vGLtP/NckKcqIuWXauX48aVyf8Dkyriwl18wYAUYqf1dFfILplLx+GJXCsc5DRsNkSLj7jNMBD2Z64TtHw3uqV84XV58+vNc5UPTzHlateMOmcZTNg4AmM/DyBMTcj3PhoVebjBcEtGtWYgId4Q1vy6sq3QOwoOMKq95TAszRUqckqQ99R2dGEfWy2rXjW6zYCNZa8aoKk+IPow== [email protected]
@chesterbr
chesterbr / gist:756abf7388a29530a365
Last active May 27, 2020 18:52
Cheryl's Birthday (aka Birthday problem)
https://en.wikipedia.org/wiki/Cheryl%27s_Birthday
A knows the month
B knows the day
The candidates are:
may 15 16 19
june 17 18
july 14 16
@chesterbr
chesterbr / ezbasic.rb
Created September 12, 2016 12:37
[WIP] running ezbasic with Ruby2600's 6507 CPU emulator
#!/usr/bin/env ruby
require 'ruby2600'
rom_file = "/Users/chester/Downloads/ehbasic.bin"
rom_addr = 0xC000
# Initialize a CPU with 64K of memory
cpu = Ruby2600::CPU.new
memory = Array.new(64*1024) { 0 }
cpu.memory = memory
@chesterbr
chesterbr / tomato-WNDR3700v3.txt
Last active March 19, 2017 01:14
Boot messages from Tomato firmware on my (bricked?) Netgear WNDR3700v3 router
Decompressing..........done
Decompressing..........done
CFE for WNDR3700v3 version: v1.0.6
Build Date: Wed May 18 17:25:10 CST 2011
Init Arena
Init Devs.
Boot partition size = 262144(0x40000)
Found an ST compatible serial flash with 128 64KB blocks; total size 8MB
@chesterbr
chesterbr / original-WNDR3700v3.txt
Created March 19, 2017 01:14
Boot messages from the original firmware on my Netgear WNDR3700v3 router
Decompressing..........done
Decompressing..........done
CFE for WNDR3700v3 version: v1.0.6
Build Date: Wed May 18 17:25:10 CST 2011
Init Arena
Init Devs.
Boot partition size = 262144(0x40000)
Found an ST compatible serial flash with 128 64KB blocks; total size 8MB