Last active
December 8, 2025 13:22
-
-
Save MoserMichael/b26ded774413458ae075e444c0e5623d to your computer and use it in GitHub Desktop.
Stuff for the hoursehold
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " 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?) | |
| # ------------------------- | |
| Finding stuff on github | |
| - search or 'Awesome XYZ' - gives sites with collection of links on topic 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... | |
| # ------------------------- | |
| # 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 | |
| # ------------------------- | |
| 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:[email protected]: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: | |
| REM restart LessManager - a service required for WSL | |
| sc stop LessManager | |
| REM shutdown WSL | |
| wsl --shutdown | |
| REM Now restart windows. | |
| shutdown /range | |
| REM used to really like WSL, but now it does all sort of funny things... | |
| #------------------- | |
| # 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' | |
| ------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment