Skip to content

Instantly share code, notes, and snippets.

Peter Marreck pmarreck

  • formerly, and currently a contractor
  • Long Island, NY
  • Sign in to view email
Block or report user

Report or block pmarreck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5bf92b9d14b8c529919c6027502fbd09
GNU nano 2.0.6 File: tsa Modified
# Run this script just before you put the laptop in the bin for security scanning.
# You can add the seconds the laptop will be waiting before speaking. The default
# is waiting for 180 seconds (3 minutes).
# Switch to the login screen, effectively locking the screen.
function lockscreen() {
/System/Library/CoreServices/"Menu Extras"/ -suspend
pnc /
Last active May 12, 2020
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
fire /
Last active Jan 5, 2020
Install Elementary Freya on ZFS root

Experimental 2015-04-25

# Create a usb disk with Elementary OS and Startup Disk Creator
# Boot it
sudo -i
apt-add-repository --yes ppa:zfs-native/stable
apt-get update
apt-get install --yes spl-dkms zfs-dkms ubuntu-zfs    

setup zfs

timruffles /
Last active Oct 13, 2019
Approaches to dependency-injection/dynamic dispatch in elixir

In many production systems you'll want to have one module capable of talking to many potential implementations of a collaborator module (e.g a in memory cache, a redis-based cache etc). While testing it's useful to control which module the module under test is talking to.

Here are the approaches I can see. The two points that seem to divide the approaches are their tool-ability (dialyzer) and their ability to handle stateful implementations (which need a pid).

Passing modules

Modules are first class, so you can pass them in. Used in EEx, where passed module must implement a behaviour.

bitemyapp / gist:8739525
Last active Jan 3, 2020
Learning Haskell
View gist:8739525
gitaarik /
Last active May 21, 2020
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
jgaskins / numeric_vs_uuid
Created Jan 17, 2014
Comparing numeric vs UUID in Postgres. Rehearsal benchmarks are thrown out. Only the second run is kept. Insertions are done all in one query to minimize the impact of I/O. This is harder to do with retrieval, but the ids are randomized in each one to minimize the effects of caching inside the database.
View numeric_vs_uuid
user system total real
Numeric 0.070000 0.010000 0.080000 ( 0.586738)
UUID 0.070000 0.020000 0.090000 ( 3.101085)
Retrieving by id
user system total real
Numeric 0.810000 0.980000 1.790000 ( 6.831551)
UUID 0.830000 0.990000 1.820000 ( 6.981944)
View gist:6216218
$ whois
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to
for detailed information.
mbbx6spp / gist:5622645
Last active Dec 17, 2015
Add this to your .bash_profile to handle history properly across multiple terminals, and output exit code of last command plus suitable fortune in appropriate color.
View gist:5622645
declare -r red=$'\e[31;40m'
declare -r blue=$'\e[0;34m'
declare -r d=$'\e[37;40m' # set this to what makes sense for your terminal color scheme
shopt -s histappend
pre_prompt() {
local exit_code=$?;
history -a;
history -n;
quchen / trolling_haskell
Last active May 9, 2020
Trolling #haskell
View trolling_haskell
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
You can’t perform that action at this time.