Skip to content

Instantly share code, notes, and snippets.

@sk22
sk22 / 1-find-new-files.sh
Last active July 19, 2020 11:20
Create listing of new files (that don't already exist) from a list of files
#!/bin/bash
while read f; do
# i think this regex doesn't make a lot of sense in this context - won't fix now
if [[ -z $(find . -name "$(echo $f | sed 's/\..*$//')*") ]]; then
echo $f >> new-files.txt
fi
done < files.txt
@sk22
sk22 / create-album-by-keyword.sh
Created July 18, 2020 15:50
Creates photo album by linking files with a certain keyword in filename/path
#!/bin/sh
# expected file structure:
# 2018/
# 2019/
# ...
# albums/
# create-album-by-keyword.sh
@sk22
sk22 / whatsapp-messages-per-day.sql
Last active July 6, 2020 16:50
sqlite3 /data/data/com.whatsapp/databases/msgstore.db
select date(timestamp / 1000, 'unixepoch') as date, count(*) as count from messages
where key_remote_jid = '43664123123@s.whatsapp.net' /* replace with someone's phone number */
group by date;
#!/bin/bash
# tweet.js is located inside twitter-archive.zip/data
cat tweet.js | sed -n 's/^.*"url" : "\(.*\)",$/\1/p' | uniq | xargs curl -sI | sed -n 's/location: \(.*\)/\1/p'
@sk22
sk22 / tweet-archive-date.js
Last active June 19, 2020 00:10
Count tweets per day
#!/usr/bin/env node
// download: https://twitter.com/settings/your_twitter_data/data
// run in twitter-archive/data/
window = {}
window.YTD = {}
window.YTD.tweet = {}
require('./tweet.js')
## CONFIG
# number of pages
pages=10
# book id, as in the url (part between `/ebook/` and `/index.html`)
# (note that this is usually just one number, but it can also be muliple, like below)
book=2366/1
# paste your cookie (from your logged in browser page) between the two single quotes below
@sk22
sk22 / README.md
Last active September 8, 2019 16:36

EXE that invokes the play/pause function.

@sk22
sk22 / how-to-media-button.md
Last active October 29, 2020 09:27
Replace "PC Manager" Fn key with play/pause

Replace "PC Manager" Fn key with custom action

How I replaced the "PC Manager" Fn key on my Huawei Matebook X Pro with a play/pause button.

Background

The Huawei Matebook X Pro, as well as other devices from various manufacturers have a Fn key with a proprietary function. On the Matebook, it's a button that does nothing but open the so-called PC Manager software, and is located on the F10 key. Since at least I really don't need this function and am missing a play/pause Fn key, I decided to try replacing the function.

how to download a video from the orf tvthek

  • open the tvthek page with the video you want to download
  • open the dev tools
    • open the network tab
    • search for 'playlist'
    • open playlist.m3u8, and open the 'response' tab
    • look for the highest given bandwidth (usually at the bottom, e.g. #EXT-X-STREAM-INF:BANDWIDTH=3192000)
    • copy the url below that, open it in a new browser tab and download it (e.g. https://apasfiis.sf.apa.at/ipad/cms-worldwide_abr/.../chunklist.m3u8&ip=...)
  • open bash
@sk22
sk22 / edit-web-page-bookmark.js
Created December 28, 2018 00:32
Bookmark to make a web page editable
javascript:(function(){document.body.contentEditable=document.body.contentEditable==="true"?"false":"true"})()