Skip to content

Instantly share code, notes, and snippets.

View mantono's full-sized avatar

Anton Österberg mantono

View GitHub Profile
@mantono
mantono / OkHttp.kt
Last active October 28, 2019 22:25
OkHttp extensions in Kotlin
package com.mantono
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import okhttp3.MediaType
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.Call
import okhttp3.Callback
import okhttp3.Request
@mantono
mantono / Config.kt
Last active October 28, 2019 20:04
Configuration loading with Typesafe config in Kotlin
package com.mantono
/**
* implementation("com.typesafe:config:1.4.0")
* See https://github.com/lightbend/config
*/
import com.typesafe.config.ConfigFactory
import com.typesafe.config.Config as TypeSafeConfig
dependencies {
implementation("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx", "kotlinx-coroutines-jdk8")
// Logging
implementation("io.github.microutils", "kotlin-logging", "1.6.20")
api("com.typesafe", "config", "1.3.4")
// Ktor
#!/bin/sh
cd ~/code/zensum
ALL_CONF=$(echo $(find . -maxdepth 2 -name "docker-compose.yml" -exec ls "{}" \;|egrep -v '(dev-env/|meta/)'|sed 's/^/-f ./'))
cd dev-env &&
docker-compose $ALL_CONF -f docker-compose.yml --project-directory . $*
[[auth_providers]]
name = "open-broker-integrations"
type = "basic_auth"
[auth_providers.basic_auth_users]
good-cash-se = "3df8232404be55d2d6b85be79b99316e028676b69efa2ce91d9094dd18dd3502"
collector-se = "c45441cb346b69e247711e9c86405ce9de964bb89c68ad02b8eb2f55912c58ba"
lendify-se = "abb9eca0af80e9f321af97b2952ca035edfdc63d5118299e32047156339955b3"
[[auth_providers]]
name = "internal-auth"
@mantono
mantono / lsmod
Created March 13, 2018 09:24
Dell XPS 13 - Hardware devices
Module Size Used by
btusb 45056 0
btrtl 16384 1 btusb
xt_nat 16384 34
xt_tcpudp 16384 38
veth 16384 0
qmi_wwan 32768 0
uas 24576 0
cdc_wdm 20480 1 qmi_wwan
usbnet 45056 1 qmi_wwan
@mantono
mantono / aur
Created October 16, 2017 20:16
Stupid simple way of installing packages from https://aur.archlinux.org/
#!/bin/bash -l
/etc/profile.d/perlbin.sh # Maybe not needed
cd /tmp &&
git clone --progress https://aur.archlinux.org/$1.git
cd $1 &&
makepkg -si
@mantono
mantono / disks
Created September 24, 2017 12:32
Disks/partitions fenchurch pre arch install
Filesystem Size Used Avail Use% Mounted on
udev 12G 0 12G 0% /dev
tmpfs 2,4G 34M 2,4G 2% /run
/dev/sde1 52G 35G 14G 72% /
tmpfs 12G 64M 12G 1% /dev/shm
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/sdf1 55G 42G 12G 78% /home
/dev/sdg1 917G 539G 374G 60% /media/bilder1
/dev/sdh1 917G 507G 406G 56% /media/bilder1_
@mantono
mantono / i3_move_workspaces.sh
Last active October 16, 2017 14:06
Move all i3 workspaces to connected monitor
#!/bin/bash
MONITORS=$(xrandr|grep -c " connected")
if [[ "$MONITORS" == 1 ]]
then
xrandr --output eDP-1 --primary
for i in {1..10}
do
i3-msg workspace $i
i3-msg move workspace to output $(xrandr|grep connected|grep -v disconnected|cut -d " " -f 1)
@mantono
mantono / arch_install_guide.sh
Last active September 24, 2017 12:31
Install Arch - Basic commands adjusted for my need
#!/bin/zsh
# Set Swedish keymap
loadkeys sv-latin1
# Verfiy that we are using UEFI
ls /sys/firmware/efi/efivars
# Check that internet works
ping archlinux.org