Skip to content

Instantly share code, notes, and snippets.

@johanlunds
johanlunds / motd.sh
Created September 13, 2023 11:10
My MOTD
# A fun MOTD!
#
# https://www.ibiblio.org/pub/linux/games/amusements/fortune/!INDEX.html (alternative to taoup)
# https://github.com/globalcitizen/taoup (with some small local edits)
# https://github.com/jaseg/lolcat (fast version)
# http://www.figlet.org/examples.html
# https://en.wikipedia.org/wiki/Cowsay
#
# Future improvements:
# - Maybe it all becomes a bit too tall and too long sometimes: figlet font, fortune text, cowsay character height

URL med mer info: https://github.com/avantrec/soco-cli

pip3 install -U soco-cli

sonos "Kök" volume 15

sonos "Kök" sharelink https://open.spotify.com/track/5p3JunprHCxClJjOmcLV8G\?si\=b3ad9bf70cc74ffa : "Kök" play_from_queue last_added

export SPKR="Kök"
# A fun MOTD!
#
# https://github.com/jaseg/lolcat (fast version)
# http://www.figlet.org/examples.html
# https://en.wikipedia.org/wiki/Cowsay
#
# Future improvements:
# - better fortunes. Check https://github.com/globalcitizen/taoup and others
# - center text
# - limit cowsay characters, limit figlet fonts - to limit height and increase readability and similarity
/*
Intro:
Filtering requirements have grown. We need to be
able to filter any kind of Persons.
Exercise:
Fix typing for the filterPersons so that it can filter users
@johanlunds
johanlunds / draw_image.js
Created January 24, 2020 10:00
Paper.js draw image example code
async function fetchImage(url) {
const response = await fetch(url);
const blob = await response.blob();
const imageBitmap = await createImageBitmap(blob);
return imageBitmap;
}
const image = await fetchImage("https://i.imgur.com/tW33eLr.png");
const canvas = await paper.get('supporterCanvas');
(Verse 1)
Suffering takes a fool
You were bad
Your truth was mythicized
Let my soul be a fool over you
Turn it down
Put my soul into your heart
Knock your heart down, down
If your heart is stronger than your truth
@johanlunds
johanlunds / amazon_product_info.json
Created January 31, 2018 15:47
This is with "response groups": ItemAttributes, Images, Offers
{
"ASIN": "B001NXD02S",
"ParentASIN": "B001NXD02S",
"DetailPageURL": "https://www.amazon.com/Rapala-X-Rap-Magnum-Fishing-Lures/dp/B001NXD02S?SubscriptionId=AKIAJLN2CNZLBWBW5AUQ&tag=13370a4-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B001NXD02S",
"ItemLinks": {
"ItemLink": [
{
"Description": "Technical Details",
"URL": "https://www.amazon.com/Rapala-X-Rap-Magnum-Fishing-Lures/dp/tech-data/B001NXD02S?SubscriptionId=AKIAJLN2CNZLBWBW5AUQ&tag=13370a4-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B001NXD02S"
},
@johanlunds
johanlunds / slack_list_employees.py
Last active January 11, 2018 18:50
List users of a Slack team that are not bots and not restricted users.
# Read how to generate "test token" (only to be used during development) here:
#
# https://slackapi.github.io/python-slackclient/auth.html#handling-tokens
#
# Install slackclient:
#
# https://github.com/slackapi/python-slackclient
#
# pip install slackclient
#
@johanlunds
johanlunds / presenter_mixin.rb
Last active August 15, 2017 15:54
A small mixin to get presenter functionality in any class.
require 'active_support/concern'
require 'active_support/core_ext/class/attribute'
module Presenter
extend ActiveSupport::Concern
included do
# class_attribute provides inheritance of the values
class_attribute :presenters
self.presenters = {}
@johanlunds
johanlunds / crash.log
Created July 28, 2017 13:59
TeeWorlds 0.6.4 crash on Mac OS Sierra 10.12.5
Process: teeworlds [77133]
Path: /Volumes/VOLUME/*/Teeworlds.app/Contents/MacOS/teeworlds
Identifier: teeworlds
Version: 0.6.4
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: teeworlds [77133]
User ID: 501
Date/Time: 2017-07-28 15:57:15.391 +0200