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:
I hereby claim:
To claim this, I am signing this object:
| # 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 |
| /* 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 { |
| // 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}`)} |
| #!/usr/bin/env bash | |
| # | |
| # Copyright (C) 2019 Erlend Ekern <dev@ekern.me> | |
| # | |
| # Distributed under terms of the MIT license. | |
| # # # # # # # # # # # # # # # # # | |
| # A script for seeking a currently playing Spotify track using the command-line | |
| # # # # # # # # # # # # # # # # # |
| 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 python3.7 | |
| # | |
| # Copyright (C) 2020 Erlend Ekern <dev@ekern.me> | |
| # | |
| # Distributed under terms of the MIT license. | |
| """ | |
| An example of using `functools.reduce` to group a list of dictionaries by a specific key. | |
| """ |
| 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 bash | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| read -r -d '' -a regions < <(aws ec2 describe-regions --query "Regions[].[RegionName]" --output text && printf '\0') | |
| for region in "${regions[@]}"; do | |
| echo "[$region] Finding CloudFormation stacks deployed using CDK" | |
| read -r -d '' -a stacks < <(aws cloudformation list-stacks --region "$region" --query "StackSummaries[?!contains(keys(@), 'DeletionTime')].[StackName]" --output text && printf '\0') | |
| test -z "${stacks:-}" && continue |
| #!/usr/bin/env bash | |
| # | |
| # Helper functions for replacing placeholders in files. | |
| # | |
| # Distributed under terms of the MIT license. | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| # Print example usage of the script. |