Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
pbrisbin / tester.sh
Last active December 27, 2015 02:39
data() {
cat <<EOF
ZootLive
125 FPS Delirium Cup - Notable signups: Spart1e Cypher dem0n Ash Twister Leszny
http://www.twitch.tv/zootlive
102ash
Untitled Broadcast
http://www.twitch.tv/102ash
QuakeAngel
Harley Quinn Halloween Special
def inner
yield
puts "method: end inner"
end
def outer
yield
puts "method: end outer"
@pbrisbin
pbrisbin / handler.sh
Created October 23, 2013 02:02
see battery acpi events as desktop notifications
#!/bin/bash
#
# /etc/acpi/handler.sh
#
###
case "$1" in
# ...
battery)
printf -v cmd "%q " 'notify-send' 'Battery' "$(acpi)"
@pbrisbin
pbrisbin / vmode.md
Last active October 10, 2017 06:34
A very extended shell scripting example, using Sed, Awk, and Bash

I want to automate monitor switching with a shell script.

The Plan

The following is the output of the xrandr command on my laptop:

Screen 0: minimum 320 x 200, current 4160 x 1600, maximum 32767 x 32767
LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
 1600x900 60.0*+ 40.0 
@pbrisbin
pbrisbin / steps.md
Created October 4, 2013 14:14
Packaging a vagrant box

Start with an available, non-desktop box, provision it to be desktop:

Vagrant.configure('2') do |config|
  box_name = "precise32"
  
  config.vm.box = box_name
  config.vm.box_url = "https://files.vagrantup.com/#{box_name}.box"

 config.vm.provision "shell", inline: "apt-get -y update"
@pbrisbin
pbrisbin / install.md
Last active August 25, 2021 14:06
Installing OpenCart on Heroku

Installation

This gets OpenCart running enough that we can use the GUI Installer

  1. Create Heroku project with ClearDB MySQL add-on
  2. Download OpenCart sources
  3. Move ./upload/* to top-level (those are the PHP site files)
  4. Copy zlib.so into ./ext/zlib.so
  5. Write extension = /app/www/ext/zlib.so into php.ini
  6. Push
@pbrisbin
pbrisbin / tag_generator.rb
Created September 27, 2013 14:42
Tag pages in Jekyll
module Jekyll
class TagGenerator < Generator
safe true
def generate(site)
site.tags.each do |tag, posts|
site.pages << TagPage.new(site, layout(site), tag, posts)
end
end
@pbrisbin
pbrisbin / maybe.md
Last active December 23, 2015 16:49
Talking points for Dev Discussion on the Maybe Monad

Types

5     :: Int

"foo" :: String -- [Char]

True  :: Bool
/srv/http/site
$ sudo ln -sf releases/201309202256 current
/srv/http/site
$ ls -l
total 4
lrwxrwxrwx 1 root root 21 Sep 20 22:54 current -> releases/201309202246/
drwxr-xr-x 4 root root 4096 Sep 20 22:56 releases/

Running camper_van as a systemd service:

gem install camper_van

[Unit]
Description=camper_van
After=network.target