I hereby claim:
- I am stekern on github.
- I am ekern (https://keybase.io/ekern) on keybase.
- I have a public key ASCIEXlhT9VjmD39jqYGgQSakoSM1yZoYUJ2JenmRPF-rQo
To claim this, I am signing this object:
python -c "import sys; import json; j = json.load(sys.stdin); json.dump(j, sys.stdout, indent=2, sort_keys=True, separators=(',', ': '))" |
#!/usr/bin/env python3.7 | |
# | |
# Copyright (C) 2020 Erlend Ekern <[email protected]> | |
# | |
# Distributed under terms of the MIT license. | |
""" | |
An example of using `functools.reduce` to group a list of dictionaries by a specific key. | |
""" |
import subprocess | |
def lambda_handler(event, context): | |
shell_command = event.get("shell_command", "") | |
with open("/tmp/script.sh", "w") as f: | |
f.write(shell_command) | |
try: | |
subprocess.check_call("sh -n /tmp/script.sh", shell=True) | |
except subprocess.CalledProcessError: | |
raise ValueError("'shell_command' does not contain a valid shell command") |
#!/usr/bin/env bash | |
# | |
# Copyright (C) 2019 Erlend Ekern <[email protected]> | |
# | |
# Distributed under terms of the MIT license. | |
# # # # # # # # # # # # # # # # # | |
# A script for seeking a currently playing Spotify track using the command-line | |
# # # # # # # # # # # # # # # # # |
// This script will calculate your GPA according to your grades on StudentWeb. | |
// 1. Go to https://fsweb.no/studentweb/resultater.jsf | |
// 2. Open up your browser's developer console | |
// 3. Run the following code | |
{const e=$x('//table[@id="resultatlisteForm:HeleResultater:resultaterPanel"]/tbody/tr[@class="none" or @class="resultatTop"]/td[contains(@class, "col6Resultat") or contains(@class, "col7Studiepoeng")]//span[last()]/text()').reduce((e,t,s,a)=>(s%3==0&&1===a[s+1].length&&e.push({grade:a[s+1].data,credits:parseFloat(a[s+2].data.replace(",","."))}),e),[]),t=e.reduce((e,t)=>e+t.credits,0),s=e.reduce((e,t)=>e+(70-t.grade.charCodeAt(0))*t.credits,0)/t;console.log(`GPA: ${s}, sum of credits: ${t}`)} |
/* Firefox > Tree Style Tab > Manage Extension > Advanced > "Extra style rules for sidebar contents" */ | |
/* Show title of unread tabs with red and italic font */ | |
.tab.unread .label { | |
color: red !important; | |
font-style: italic !important; | |
} | |
/* Add private browsing indicator per tab */ | |
.tab.private-browsing .label:before { |
# Creates a 20-second video with a scrolling text overlay. | |
# The image is named 'input.png', and the textfile it reads from is called 'yourfile.txt'. | |
# Create a video of the image | |
ffmpeg -loop 1 -t 20 -i input.png output.mp4 | |
# Add scrolling text to the video | |
ffmpeg -i output.mp4 -filter_complex \ | |
"[0]split[txt][orig];[txt]drawtext=fontfile=tahoma.ttf:fontsize=55:fontcolor=white:x=(w-text_w)/2+20:y=h-20*t:textfile='yourfile.txt':bordercolor=black:line_spacing=20:borderw=3[txt];[orig]crop=iw:50:0:0[orig];[txt][orig]overlay" \ | |
-c:v libx264 -y -preset ultrafast -t 20 output_scrolling.mp4 |
I hereby claim:
To claim this, I am signing this object: