This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Older docker which does not have prune command | |
# | |
# Stop all containers | |
docker stop $(docker ps -a -q) | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Clojure-harjoituskoodi Finnkinon XML-rajapinnan lukemiseen. | |
; Tarkoitettu alunperin ClojureBridgeen osallistuneille oppilaille | |
; ohjelmoinnin jatkoharjoittelua varten. | |
(ns finnkino-api-lukija.core | |
(:require [clojure.xml :as xml]) | |
(:gen-class)) | |
; Käytettävän rajapinnan osoitteet | |
(def teatterit-api "http://www.finnkino.fi/xml/TheatreAreas/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Paradox database -> CSV converter | |
# (C) 2016 Teemu Frisk / Pandia Ltd | |
# MIT License | |
# | |
# Usage: | |
# 1) Make sure this script and its related paradox.py files are in the same dir | |
# 2) Create directory for paradox files and copy the entire db there |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; --------------------------------------------------- | |
; https://github.com/ClojureBridge/curriculum/blob/master/outline/flow_control.md | |
(defn ordinal [n] | |
(let [r (rem n 10)] | |
(if (and (> n 10) (< n 15)) | |
(str n "th") | |
(if (= r 1) | |
(str n "st") | |
(if (= r 2) | |
(str n "nd") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_helper.exs: | |
exclude = | |
if Node.alive?, do: [], else: [distributed: true] | |
ExUnit.start(exclude: exclude) | |
router_test.exs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I have to look this up every time so it's about time to write it down | |
# Source: https://stackoverflow.com/questions/19953653/how-to-set-up-postgres-database-for-local-rails-project | |
Login to postgresql prompt as the postgres user | |
# sudo su postgres -c psql | |
Create a postgresql user for your project | |
=# create user username with password 'password'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find count of code lines in Clojure source files | |
cat file.clj | grep -e '^$' -e '^;' -v | wc -l | |
# How it works? | |
# | |
# cat file.clj view file with cat command | |
# | pipe the output of cat command to the following commands | |
# grep read the input (piped cat) and match it to given regular expressions | |
# -e '^$' look for line start (^) followed by immediate end ($) -> empty line | |
# -e '^;' look for line start (^) followed by Clojure comment mark (;) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Wunderdogin koodaustehtävän ratkaisuehdotukseni, alkuperäinen sivu täällä: http://wunderdog.fi/koodaus-hassuimmat-sanat/ | |
; Julkistettu kaikille kilpailun päättymisen jälkeen. | |
(ns alastalon-salissa-clj.core) | |
; sanojen pisteytys: | |
; Jokainen vokaaliketju saa n×2n pistettä, jossa n on vokaalien määrä ketjussa. | |
; Sanan vokaaliketjujen saamat pisteet lasketaan yhteen, jolloin saadaan sanan | |
; hassuuspisteet. | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ############## | |
; vaativampi ESIMERKKI: lottoarvonta | |
; tila myohempaa kayttoa varten, ei viela kaytossa | |
(def app-state (atom | |
{:rivimaara 0 ; montako rivia pelataan? | |
:rivit [] ; arvotut n rivia | |
:voittorivi [] ; arvottu voittorivi | |
:tulokset [] ; montako oikein per rivi? | |
:voittosumma 0 ; yhteenlaskettu voittosumma tuloksista |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Debian has older Erlang package (R15) in official repositories, Elixir requires newer (R17) | |
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
sudo dpkg -i erlang-solutions_1.0_all.deb | |
sudo apt-get update | |
sudo apt-get install -y erlang | |
rm erlang-solutions_1.0_all.deb | |
# compile Elixir from source |
NewerOlder