Skip to content

Instantly share code, notes, and snippets.

@auramo
auramo / body_count.py
Created March 27, 2020 19:56
Jenkkien ruumiit pääsiäiseks
days = 16
current_body_count = 400
body_count = current_body_count
for d in range(1, days+1):
if d % 3 == 0:
body_count = body_count * 2
print("body count: ", body_count)
@auramo
auramo / prettier-idea.md
Created May 17, 2018 17:37
Prettier IDEAan

Add prettier to Intellij IDEA

npm install -g prettier
which prettier

-> ^ remember the path

IDEA: settings -> external tools -> add new

const password = 'kuikka'
const keyIv = cryptoUtils.deriveAES256KeyAndIv(password.replace(/\s/g, ''))
const maxFileSize = 2 * 1024 * 1024 * 1024
const isMeb = fileName => /\.meb$/.test(fileName)
const isZip = fileName => isMeb(fileName) || /\.zip$/.test(fileName)
const isEncryptedZip = fileName => /\.zip\.bin$/.test(fileName)
const isEncryptedJson = fileName => /\.json\.bin$/.test(fileName)
const readZipContents = (zipFileName, zipContents) => {
@auramo
auramo / gist:0fd4a3a2cc145009411abf5805e732cc
Created May 11, 2016 12:45
Yegge for the lack of a nail
For the lack of a nail,
throw new HorseshoeNailNotFoundException("no nails!");
For the lack of a horseshoe,
EquestrianDoctor.getLocalInstance().getHorseDispatcher().shoot();
For the lack of a horse,
RidersGuild.getRiderNotificationSubscriberList().getBroadcaster().run(
new BroadcastMessage(StableFactory.getNullHorseInstance()));
@auramo
auramo / Scala Option handling
Last active April 7, 2016 06:47
Examples on how Option is handled neatly
// Map and flatMap for Options/Lists
scala> val myList : List[Option[Int]] = List(Some(1), None, Some(2))
myList: List[Option[Int]] = List(Some(1), None, Some(2))
scala> myList.flatten.map(x=>x*2)
res15: List[Int] = List(2, 4)
scala> myList.flatMap((x) => x.map(_*2))
res16: List[Int] = List(2, 4)
@auramo
auramo / gist:76a9cfaa85eabd0eb1b9
Created March 16, 2016 17:32
node static server
var express = require('express');
var app = express();
app.use(express.static('public'));
app.listen(8000, function () {
console.log('Example app listening on port 8000!');
});
@auramo
auramo / gist:74a9f0c106692921c8ac
Created March 8, 2016 11:40
Just store this under /etc/systemd/system/mailcatcher.service
[Unit]
Description=Mailcatcher service
After=network.target
[Service]
WorkingDirectory=/opt/node/apps/hela-webapp
ExecStart=/usr/local/bin/mailcatcher -f --smtp-port 2155 --http-ip=0.0.0.0 --http-port 8181 --smtp-ip=0.0.0.0
Restart=always
StandardOutput=syslog
StandardError=syslog
@auramo
auramo / gist:80fd43eb326c56d62157
Created October 8, 2015 11:18
Unistack NODE_ENV=production WARNings
util.error: Use console.error instead
WARN: Condition always false [-:8426,6]
util.error: Use console.error instead
WARN: Dropping side-effect-free statement [-:8426,6]
util.error: Use console.error instead
WARN: Condition always false [-:8436,49]
util.error: Use console.error instead
WARN: Condition always false [-:8441,95]
util.error: Use console.error instead
WARN: Condition always false [-:8454,34]
@auramo
auramo / gist:c20d43973e609dbbcff7
Last active September 7, 2015 13:34
linux device drivers
sailniir: @auramo http://shop.oreilly.com/product/0636920030867.do
Linux Device Drivers
Having already helped two generations of programmers explore Linux and write devices, the fourth edition of this classic book delves into tty, USB, and HCI devices such as keyboards, in addition to...
[12:27 PM] auramo: tost ajattelin kysyä, mut onkohan jo obsolete
[12:28 PM] sailniir: eli odottaa hän vielä vuosi ja 2 kuukautta kivasti ;-)
[12:28 PM] sailniir: mä kattelin vuodenvaihteessa että kesällä pitäis tulla toi neljäs editio, kesällä se oli sit tulossa lokakuussa, ja nyt tulossa Nov 2016
@auramo
auramo / figwheel-emacs-cider.txt
Created August 6, 2015 12:35
figwheel emacs cider stuff
## Using Emacs CIDER as the Figwheel REPL tool
project.clj should have this line:
```
:figwheel { :nrepl-port 7888 }
```
At the defproject-level.
It enables external tools to connect to the Figwheel REPL. To connect