Skip to content

Instantly share code, notes, and snippets.

View 573's full-sized avatar

Daniel Kahlenberg 573

View GitHub Profile
@mneedham
mneedham / rover.hs
Created June 15, 2012 22:34 — forked from uday-rayala/rover.hs
Mars rover in haskell
data Position = Position Int Int Direction
deriving (Show, Eq, Read)
data Direction = N | E | W | S
deriving (Show, Eq, Enum, Bounded, Read)
data Command = L | R | M
deriving (Show, Eq, Enum, Bounded, Read)
data DeltaPosition = DeltaPosition Int Int deriving (Show)
data State = State {
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 22, 2025 11:42
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@richieforeman
richieforeman / makeauthority.sh
Created July 23, 2012 21:38
Issue Your Own Self-Signed S/MIME Certs with OpenSSL
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@zinkkrysty
zinkkrysty / 0_readme.markdown
Last active December 9, 2015 16:58 — forked from mrdanadams/create_origin.sh
Use Dropbox for a git repository in the cloud. I use it for backup purposes.
@biovisualize
biovisualize / README.md
Last active July 29, 2019 14:42
Test for attaching a png to a gist
  1. Create a new public gist on https://gist.github.com/
  2. Under "Clone this gist", copy the link (i.e., https://gist.github.com/4415518.git)
  3. If you have the command line git tools, clone this gist to a local folder: git clone https://gist.github.com/4415518.git
  4. It will add a folder with the gist id as a name (i.e., 4415518) under the current working directory. Navigate to this folder in the command line: cd 4415518 (dir 4415518 on windows)
  5. Navigate to this folder in your file explorer and add an image (i.e., test.png)
  6. Add it to git from the command line: git add test.png
  7. Commit it to git: git commit -m "I just added a file!"
  8. Push this commit to your remote gist (you will need your Github user name and password): git push
  9. Go back and refresh your Gist on https://gist.github.com/ to confirm that it worked
@sebfisch
sebfisch / Mappers.hs
Last active December 14, 2015 08:48
{-
A German blog post translating Java code for the build tool Ant to Scala
http://funktionale-programmierung.de/2013/02/26/scala-java-ant.html
made me translate the Scala code to Haskell. I added combinators for binary
composition of mappers as well as a unit mapper for one of them. The code is
still shorter. I find the Haskell version more readable because expressions
and their types are separate rather than interleaved as in Scala.
@jonschlinkert
jonschlinkert / markdown-cheatsheet.md
Last active November 9, 2025 10:21
A better markdown cheatsheet.
@lfo
lfo / launchMaven
Created July 19, 2013 09:35
Debug maven test externally in windows share mode
mvn clean install -Dmaven.surefire.debug=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,address=Maven,suspend=n
# In Netbeans Debug/attachDebugger with
# connector : SharedMemory
# Name : Maven
# Timeout : 10 000
@reiz
reiz / gist:6203767
Created August 11, 2013 06:52
Creating a MavenProject from an ArtifactInfo inside a maven plugin.
protected MavenProject buildProjectModel(ArtifactInfo artifactInfo) throws Exception {
try {
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
configuration.setLocalRepository( localRepository );
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
configuration.setProcessPlugins( false );
configuration.setRepositoryMerging( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT );
Properties properties = new Properties( );
for ( String key : session.getSystemProperties( ).keySet() ){
properties.put( key, session.getSystemProperties().get(key) );

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)