Skip to content

Instantly share code, notes, and snippets.

@erubboli
erubboli / image_to_array.rb
Created September 22, 2011 23:18
convert an image to c array
//Convert the 128x128 image with:
// convert image.jpg image.rgb
res=128
img_file = File.open(ARGV[0],'r')
puts "static char image[#{res*res}] = { "
img_file.bytes.each_slice(res) do |l|
puts " #{l.join(',')}"
end
@erubboli
erubboli / in_bash_profile.sh
Created December 4, 2011 11:27
add branch to PS1
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "["${ref#refs/heads/}"]"
}
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
@robotarmy
robotarmy / Gemfile
Created March 23, 2012 23:55
Adding Rake to Sinatra with Rspec
gem 'sinatra'
group :development,:test do
gem 'rspec'
gem 'rack-test'
end

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
anonymous
anonymous / bubblegum.md
Created September 23, 2014 15:02
Rules for "All out of bubblegum"

All Outta Bubblegum

This game is copyright 2001, Michael "Epoch" Sullivan and Jeffrey Grant. If you want to repost it or whatever, drop me an email.

Characters in All Outta Bubblegum have one stat -- Bubblegum. It's technically a number which varies from 0 through 8, though the designers highly, highly recommend that you don't do anything so banal as write down a number, and, instead, pass out actual sticks of bubblegum to the players. This will also help when you play All Outta Bubblegum drunk, which is, let's be blunt, probably the only time you'd even consider playing this game.

Bubblegum always starts out at 8.

Resolution

@remvee
remvee / time.cljs
Last active June 25, 2022 00:34
Calculate week number in clojurescript
(defn week-number
"Week number according to the ISO-8601 standard, weeks starting on
Monday. The first week of the year is the week that contains that
year's first Thursday (='First 4-day week'). The highest week number
in a year is either 52 or 53."
[ts]
(let [year (.getFullYear ts)
month (.getMonth ts)
date (.getDate ts)
day (.getDay ts)
@abhin4v
abhin4v / upsert.clj
Last active July 4, 2022 20:42
Postgres Upsert in Clojure using clojure.java.jdbc and honeysql.
(ns postgres.upsert
(:require [honeysql.core :as sql]
[clojure.java.jdbc :as jdbc]
[clojure.string :as str]
[clojure.set :as set]))
(defn- keyword->colname [kwd]
(-> kwd
name
(str/replace #"-" "_")))
@alirobe
alirobe / reclaimWindows10.ps1
Last active July 3, 2024 09:36
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?