Skip to content

Instantly share code, notes, and snippets.

View codegoalie's full-sized avatar

Chris Marshall codegoalie

View GitHub Profile
@codegoalie
codegoalie / alter.sh
Created May 17, 2011 01:08
Shell Alert for long running commands
# I didn't write this and I'm not sure where it came from...
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
<html>
<head>
<title>John Doe's web page</title>
</head>
<body>
<script type="text/javascript">
// Use a popup box here to read the user name
// and write a personalized greeting
{
var name=prompt("Please enter your name","Harry Potter");
@codegoalie
codegoalie / all_fixed.sh
Last active December 12, 2015 07:48
Help! I lost a commit from days ago!!! post
chrismar035:super_sweet_project(master) $ git lg
* 99f0b00 - LOST COMMIT!!! (just now) <Chris Marshall>
* faa7737 - Merge branch 'features/sweet_feat' (1 day ago) <Chris Marshall>
|\
| * 3ce8e66 - Commit after the lost one (1 day ago) <Chris Marshall>
| * 9418734 - Commit before the lost one (1 day ago) <Chris Marshall>
|/
* b67ec4c - Other unrelated commit (2 days ago) <Chris Marshall>
...
require 'benchmark'
n = 500_000
Benchmark.bm(7) do |x|
x.report('append:') do
a = ''
n.times { a << 'a' }
end
x.report('+=:') do
@codegoalie
codegoalie / decimal_divider.go
Created June 14, 2014 15:52
Go Concurrency Examples
package main
import (
"fmt"
)
func decimal_divide(numerator, denominator int, c chan int) {
// do long division "by hand"
for ; numerator != 0; numerator = numerator % denominator {
numerator = numerator * 10
@codegoalie
codegoalie / contacts.log
Created June 15, 2014 19:16
Logcat of Contacts App failure on CM 11 Nexus 5
I/ActivityManager( 1119): START u0 {act=android.intent.action.VIEW dat=content://com.android.contacts/contacts/lookup/2746i2dab0ce008626dbc/263 flg=0x80000 cmp=com.android.contacts/.activities.ContactDetailActivity} from pid 30725
I/ContactLoader(30725): Registering content observer for content://com.android.contacts/contacts/lookup/2746i2dab0ce008626dbc/263
I/ActivityManager( 1119): Displayed com.android.contacts/.activities.ContactDetailActivity: +193ms
W/PhoneNumberFormatter(30658): Error type: NOT_A_NUMBER. The phone number supplied was null.
W/PhoneNumberFormatter(30658): at com.google.i18n.phonenumbers.PhoneNumberUtil.parseHelper(PhoneNumberUtil.java:2771)
W/PhoneNumberFormatter(30658): at com.google.i18n.phonenumbers.PhoneNumberUtil.parse(PhoneNumberUtil.java:2684)
W/PhoneNumberFormatter(30658): at com.google.i18n.phonenumbers.PhoneNumberUtil.parse(PhoneNumberUtil.java:2674)
W/PhoneNumberFormatter(30658): at org.whispersystems.textsecure.util.PhoneNumberFormatter.formatNumber(PhoneNumberFormatter.j
### Keybase proof
I hereby claim:
* I am chrismar035 on github.
* I am chrismar035 (https://keybase.io/chrismar035) on keybase.
* I have a public key whose fingerprint is 1710 2A86 50B7 CD4C 6325 2B9B 81D4 F79F BDFA 7EAF
To claim this, I am signing this object:
#!/bin/bash
# This script takes story ID and type then a branch subname.
# It will use goutrack to mark the story as in progress and create a new branch
# in the current directory off the current branch with the format:
# <type>/<ID>-<subname>
while [[ $# > 1 ]]
do
key="$1"

Keybase proof

I hereby claim:

  • I am codegoalie on github.
  • I am codegoalie (https://keybase.io/codegoalie) on keybase.
  • I have a public key ASCBibAlr_5Q_k6LdB1S5BXOjqo4lV1rii6vI7g92shZago

To claim this, I am signing this object:

package models
// Place represents a place of residence to be listed and filtered
type Place struct {
Name string
Region string
Location string
ContactName string
SquareFeet int
}