Skip to content

Instantly share code, notes, and snippets.

@MoserMichael
Last active January 2, 2026 05:59
Show Gist options
  • Select an option

  • Save MoserMichael/b26ded774413458ae075e444c0e5623d to your computer and use it in GitHub Desktop.

Select an option

Save MoserMichael/b26ded774413458ae075e444c0e5623d to your computer and use it in GitHub Desktop.
Stuff for the hoursehold
" Set text width as 72.
# Collection of various stuff & advice
# -------------------------
Link to google in AI mode, with the option to chat with a LLM.
Probably uses Gemini of various versions, the version can probably vary - according to task.
https://www.google.com/search?udm=50
Gemini seems to be stronger in technical/software questions, as compared to DeepSeek.
Downside: this page does not show past conversations, so you can't go back and dig deep on anything...
(but it is great, if you need to research a specific technical task!)
Chat with DeepSeek when asking for details on literature, art, in short: life, the universe and everything...
(did DeepSeek get the better pre-training? I think they trained deepseek with more various language input. I think that is really making a difference.)
# -------------------------
Finding stuff on github
- search or 'Awesome XYZ' - gives sites with collection of links on topic XYZ.
- also 'curated list of XYZ'
- SEARCH FOR 'XYZ from scratch' - a repo with advice on how given XYZ is really working
- if logged into github, and you follow some people: github.com will show a news ticker on what your friends are up to. github rocks as a social network!
- also there is https://github.com/trending
- (Unrelated) Some of the most trending stuff are not open source projects!
- It seem like github is very big in China.
- This one: [censorship of github](https://en.wikipedia.org/wiki/Censorship_of_GitHub)
- Nowadays it seems that github is slowed down in China, but that developers are all using VPN's...
# -------------------------
https://gist.github.com/forked - sometimes possible to find interesting stuff here!
(the 'all gists' stuff is usually not very interesting,
the 'forked' tab shows gists that have been forked by someone, that's usually more useful stuff..
Apparently, being 'forked' on github is a more significant indicator of utility that number of stars, apparently...)
--
# for search box in https://gist.github.com/
stars:>10 language:markdown
# This searches for gists in markdown and with 10 or more stars
--
# this searches for gists with more than 3 stars.
forks:>3
# -------------------------
youtube starts to suck? IPTV to the rescue! https://github.com/iptv-org/iptv
- with VLC https://iptv-org.github.io/iptv/index.m3u
- start VLC media player
- Media / Open network stream
- paste the playlist url into it:
- main playlist: https://iptv-org.github.io/iptv/index.m3u
- playlists per country can be found on this page: https://github.com/iptv-org/iptv/blob/master/PLAYLISTS.md
- Germany playlist https://iptv-org.github.io/iptv/countries/de.m3u
- Berlin playlist https://iptv-org.github.io/iptv/subdivisions/de-be.m3u
- wait a minute, it doesn't start up immediately, may display some errors at the start.
- instead of VLC: can use this free web based tool: https://pleyr.net works more reliably than VLC
- go to Settings
- paste in the playlist url
Feels a bit like in old east germany: watching West German TV over the fenced wall, this time I am watching over the internet!
---
Another alternative. I am often listening to https://3wk.com/ - the home of music.
- I don't know how they man aged to keep on for so long. Its a small wonder.
- I think that 3wk is the difference between AI generate content and some Human in the background, who has a heart. Thanks, 3wk!!!
The music they are playing is much better than any suggestions on youtube. I keep wondering how these great guys manage to keep afloat..
# -------------------------
# downloading youtube videos via command line...
# yt-dlp (best to use it via virtual env)
# installing yt-dl
# - (never do apt-get install - this doesn't work here)
# why? it is a cat-and-mouse game, they update the package and google tries to make it stop -
# an older version will just not work.
#
# - Better install it via:
#
python3 -m pip install -U "yt-dlp[default]"
# also must add to path /home/user/.local/bin/
# download youtube video as mp4 (can share that via whatsapp)
yt-dlp https://www.youtube.com/shorts/3qbhcgOcx2o?feature=share -o multik.mp4 -t mp4
# added the following shortcut function to .bashrc
function youtube {
local url lfile
url=$1
lfile="${2:-download}"
if [ -f "${lfile}.mp4" ]; then
rm - f ${lfile}.mp4
fi
set -x
yt-dlp $url -o ${lfile}.mp4 -t mp4
set +x
}
# -------------------------
# given a video file: you can extract a section of the sound (for example if you want to turn that into a ringtone)
# (in his example the sound between 1:00 and 2:00 is copied)
# and extract audio from file downloaded-video.mp4 from 1:00 to 2:00 and put that into output.mp4a
# ffmpeg downloaded via: sudo apt-get install ffmpeg ; also make sure /usr/bin is in the path
ffmpeg -hide_banner -y -i downloaded-video.mp4 -ss 1:00 -to 2:00 -vn -c:a aac -f mp4 output.mp4a
# now a function to put in .bashrc for doing so:
cutsound_usage='<local-video-file> [<from-time>] [<to-time>] - copy sound to output.mp4a, optionaly set range'
function cutsound() {
local lfl stime etime
lfl=$1
stime=${2:+"-ss $2"}
etime=${3:+"-to $3"}
set -x
ffmpeg -loglevel warning -y -i $lfl $stime $etime -vn -c:a aac -f mp4 output.mp4a
set +x
}
# -------------------------
# function to put into bashrc, cuts a section out of a video
cutvideo_usage='<url> [<from-time>] [<to-time>] - copy a portion local file, the file name includes the cut times'
function cutvideo() {
local lfl ofl stime etime addtitle add
lfl=$1
stime=${2:+"-ss $2"}
etime=${3:+"-to $3"}
add_title=${2:+"_from_$2"}${3:+"_to_$3"}
ofl="${lfl%.*}${add_title}.cut.mp4"
set -x
ffmpeg -loglevel warning -y -i $lfl $stime $etime -f mp4 $ofl
set +x
}
# -------------------------
mergevideo_usage='lfile1.mp4 ... lfilen.mp4 - merge some local files into a output file - merged.mp4 '
function mergevideo() {
local temp_file
temp_file=$(mktemp)
for f in "$@"; do
echo "file '$f'" >>${temp_file}
done
cat "${temp_file}"
set -x
ffmpeg -loglevel warning -y -f concat -safe 0 -i $temp_file -c copy -fflags +genpts merged.mp4
#ffmpeg -loglevel warning -y -f concat -safe 0 -i $temp_file -c copy -fflags +igndts merged.mp4
set +x
}
# -------------------------
# combining multiple pictures / pdf /etc into one final.pdf file (for official usage)
convert a.jpg b.jpg c.pdf final.pdf
# installation of convert
sudo apt-get install imagemagick
# -------------------------
# get a list of pdf files and sort them by last access time
find . -name '*.pdf' -printf "%T+ %p\n" 2>&1 | sort
# -------------------------
You may have to install windows on your own: can happen if you bought a windows PC that comes without preinstalled windows.
The windows11 installer is requesting a networking driver during installation
it says "lets connect to your local network"
...and you have no idea what to do...
- Search for the wi-fi driver for your PC model on https://www.drvhub.net
- hint: if it's a budget PC then it is most likely a Realtek driver, otherwise it is Intel.
- copy the driver that comes without msi installer to to a usb device and use that.
# -------------------------
# run postgres in a docker container, while its data is stored in a local directory
# run postgress, while its data is put in docker volume my-pg-data,
# in detached mode, while listening on port 5432, with given credentials.
# ! make sure to use the same password with same volume. Change volume if it doesn't work !
docker run --rm --name postgresql_srv -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -v my-pg-data:/var/lib/postgresql -d postgres:latest
# Also needed: pgadmin download url: https://www.pgadmin.org/download/
# but you can do it with postgresql
# specify password in env variable, so you don't have to type it
export PGPASSWORD=postgres
# connect to
psql -h 0.0.0.0 -p 5432 -U postgres
# default db name when running pg like this is: postgres
psql -h 0.0.0.0 -p 5432 -U postgres -d postgres
#--
# or rather specify a connect string for http(s)
#
# the format:
# postgresql://<DBUSER>:<DBPASSWRD>@<HOST>:<PORT>/<DBNAME>
psql postgresql://postgres:postgres@0.0.0.0:5432/postgres
#--
# to dump the sql create statement for table sh1.aaa
# - first attach to the docker that is running pg (version of pg_dump has to match the postgres version!)
docker exec -it postgresql_srv /bin/bash
# in the docker you have a matching pg_dump version!
# dump table sh1.aaa
pg_dump -h 0.0.0.0 -p 5432 -U postgres -d postgres -s -t sh1.aaa
#-------------------
Working on windows with WSL? WSL is slow as shit?
This is supposed to fix it:
we have a batch file for that!
----
REM restart LessManager - a service required for WSL
sc stop LessManager
REM shutdown WSL
wsl --shutdown
REM Now restart windows.
shutdown /s
REM * used to really like WSL, but now it does all sort of funny things...
REM * I think Microsoft had some significant layoffs around 24-25. After that WSL started to suck.
REM * I may be wrong about that...
----
#-------------------
# Want to show your kids that REST api is a cool thing?
# There is a nice REST api that does not require an api key or throttle after three requests!
# it gives you the weather forecast for your location.
# It is open source and has a nice description of the API https://github.com/chubin/wttr.in
# three days forecast for Tel Aviv
curl 'https://wttr.in/Tel+Aviv'
# or give the same report in different languages
curl 'https://wttr.in/Tel+Aviv?lang=he'
curl 'https://wttr.in/Tel+Aviv?lang=fr'
# even gives you a chance to talk about url encoding :-)
curl 'https://wttr.in/Modi%27in+Maccabim+Reut'
# or for landmarks!
curl 'https://wttr.in/~Wailing+Wall'
curl 'https://wttr.in/~Eifel+Tower'
# or show it as a picture, in the browser
http://wttr.in/Jerusalem.png
# or tell it to do format in json (very detailed format, never knew there were so many details in a weather forecast)
# don't know what half of the values mean.
# (but the request is of high latency...)
curl 'http://wttr.in/Jerusalem?format=j1'
------
there is a reference of public REST api's https://publicapi.dev
(curiously it doesn't know anything about wttr.in :-)
# -------------------------
# didn't know that:
# in bash:
# |&
# is the same as
# 2>&1 |
$ cat no-such-file.txt | grep 'No such file' | wc -l
cat: no-such-file.txt: No such file or directory
0
$ cat no-such-file.txt 2>&1 | grep 'No such file' | wc -l
1
$ cat no-such-file.txt |& grep 'No such file' | wc -l
1
# - useless stuff, it is easy to mix up |& with &|
$ - the second one runs the command in the background.
# - better do 2>&1 |
# -------------------------
Something they teach engineers: napkin math of how much every action is takin: (L1/L2 cache hit, vs main memory access, vs disk access, vs network access)
- https://gist.github.com/jboner/2841832
- https://colin-scott.github.io/personal_website/research/interactive_latency.html
- https://github.com/sirupsen/napkin-math
Don't know how exact this is, these guys were measuring things a couple of years ago.
What is important: understanding the order of magnitude differences between each of the main categories...
-
In a way it this peace of lore is a condensed version of 'What Every Programmer Should Know About Memory' by Ulrich Drepper
https://people.freebsd.org/~lstewart/articles/cpumemory.pdf
-
There is a git repository on 'what every programmer should know about xxx' with links to various stuff. Very recommended.
https://github.com/mtdvio/every-programmer-should-know
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment