Skip to content

Instantly share code, notes, and snippets.

View cellularmitosis's full-sized avatar

Jason Pepas cellularmitosis

View GitHub Profile
@cellularmitosis
cellularmitosis / README.md
Last active June 11, 2020 18:17
Source this in your bashrc for colored username and exit status

Blog 2012/9/9

index | next ->

Colorized Bash prompt

Source this in your ~/.bashrc for colorized username and exit status.

@cellularmitosis
cellularmitosis / README.md
Last active June 11, 2020 18:17
hexify: a tiny function which converts binary data into hex. styled after snprintf.
@cellularmitosis
cellularmitosis / README.md
Last active June 11, 2020 07:30
Bash functions to read bogomips and cpu mhz from /proc/cpuinfo

Blog 2015/10/2

<- previous | index | next ->

iscpuslow.sh: Bash function to read bogomips and MHz from /proc/cpuinfo

I had a need to run a script but have different behavior on older machines vs. newer machines,

@cellularmitosis
cellularmitosis / xev.log
Created October 4, 2015 19:40
xev output illustrating what appears to be a hardware bug in the keyboard of my HP ProBook 4530s. See http://unix.stackexchange.com/questions/233506/working-around-a-buggy-keyboard-hacking-an-input-stream
KeyPress event, serial 40, synthetic NO, window 0x2600001,
root 0x93, subw 0x0, time 63046084, (824,397), root:(828,422),
state 0x0, keycode 32 (keysym 0x6f, o), same_screen YES,
XLookupString gives 1 bytes: (6f) "o"
XmbLookupString gives 1 bytes: (6f) "o"
XFilterEvent returns: False
KeyPress event, serial 40, synthetic NO, window 0x2600001,
root 0x93, subw 0x0, time 63046247, (824,397), root:(828,422),
state 0x0, keycode 30 (keysym 0x75, u), same_screen YES,
@cellularmitosis
cellularmitosis / create_yosemite_iso.sh
Last active March 14, 2016 11:59
create_yosemite_iso.sh: Create a bootable .iso OS X Yosemite installer (for use with e.g. VirtualBox)
#!/bin/bash
# create_yosemite_iso.sh: Create a bootable .iso OS X Yosemite installer (for use with e.g. VirtualBox)
# See https://gist.github.com/cellularmitosis/6e902579296e82ec6273
# This is a (slightly) edited version of IOOI SqAR's script.
# See http://sqar.blogspot.de/2014/10/installing-yosemite-in-virtualbox.html
# Changes from IOOI SqAR's script include:
# * Use 'hdiutil makehybrid' to convert the .cdr image to a "real" .iso image.
@cellularmitosis
cellularmitosis / ViewController.swift
Created November 12, 2015 20:54
UIViewController containment bug demo
//
// ViewController.swift
// ContainerTimingBugDemo
//
// Created by Jason Pepas on 11/12/15.
// Copyright © 2015 Jason Pepas. All rights reserved.
//
/*
@cellularmitosis
cellularmitosis / ViewController.swift
Last active November 13, 2015 18:18
Workaround for UIViewController containment bug
//
// ViewController.swift
// ContainerTimingBugDemo
//
// Created by Jason Pepas on 11/12/15.
// Copyright © 2015 Jason Pepas. All rights reserved.
//
/*
//: Playground - noun: a place where people can play
import UIKit
struct Item {
var price: Int
var count: Int
}
enum VendingMachineError: ErrorType {
//: Playground - noun: a place where people can play
import UIKit
//: Playground - noun: a place where people can play
import UIKit
struct Item {
var price: Int
@cellularmitosis
cellularmitosis / gist:64d4a2d2d6dfa33916fc
Created January 19, 2016 19:25
Alternate take on the sequence protocol using AnyGenerator. See http://stackoverflow.com/a/26219833/558735
// paste this into a playground
import Foundation
class Car {
var name : String
init(name : String) {
self.name = name
}
}