Linkdump 27/2024

Gitlab Send testmails gitlab-rails console # on rails console: Notify.test_email('you@example.com', 'Message Subject', 'Message Body').deliver_now Reset you initial root password gitlab-rake "gitlab:password:reset[root]" Solve Error 500 when (changing application settings) gitlab-psql -d gitlabhq_production # on PSQL-Shell DELETE FROM application_settings; Linux Linux Terminal key combinations Kubernetes Working with container registries Get all available container images ...

July 7, 2024 · 1 min · Daniel Hufschläger

Caclulating QR-Code URLs for the Actimel/Pokémon lottery

Einfaches Python-Skript zur Berechnung der QR-Codes für das Acitmel Pokemon Gewinnspiel: from hashlib import sha256 names = ['dragonite', 'fidough', 'fuecoco', 'gyarados', 'munchlax', 'bellibolt', 'greavard', 'charmeleon', 'charmander', 'bulbasaur', 'charizard', 'blastoise', 'ivysaur', 'pawmi', 'pichu', 'pikachu', 'quaxly', 'smoliv', 'raichu', 'sprigatito', 'squirtle', 'venusaur', 'wartortle'] for name in names: hsh = sha256(name.encode('utf-8')).hexdigest() print(f'{name: <{10}} | https://pokemon.actimel.de/welcome?scan={hsh}') This results in the following: Pokémon URL dragonite https://pokemon.actimel.de/welcome?scan=042ce75d492cb394999ff4fc039d13fa22678485056ab32812fdbd1b88480089 fidough https://pokemon.actimel.de/welcome?scan=2f67aac66c98287d52a3d4efc51b83c242c161889c7f42674eeda150ebdc771d fuecoco https://pokemon.actimel.de/welcome?scan=5a4647c1f3fa84997a6ddea1f4ad39461e218b0d8fc803df8fafe53600b46b9f gyarados https://pokemon.actimel.de/welcome?scan=7cb2e6f544eb21f608aa5d8e60de3fb58636c34a03d1ed1226dfb0abad88598e munchlax https://pokemon.actimel.de/welcome?scan=310a6e1a21da2d2d320237ccc713c93df80955f7933dd8a6a184ed23237ddfea bellibolt https://pokemon.actimel.de/welcome?scan=de776cea1f7b724768844115f77ff826ee20a0f8f0b7792130c4b35dbe297a08 greavard https://pokemon.actimel.de/welcome?scan=e240ed5c2cdbbefc3c48ea9a184665137cf8a553a5024fef78205338f4617a90 charmeleon https://pokemon.actimel.de/welcome?scan=dcc51a1369ed1884e6f26512b8811092181e07b3e386cebfed452fa51c70244e charmander https://pokemon.actimel.de/welcome?scan=8cbfa8573683626c1609d1373f23b63bbfa5692fccad285e0306a500fa4b28f9 bulbasaur https://pokemon.actimel.de/welcome?scan=b5b5652a5dd3d781e2f6f412223e843cacbf2872091f485ed5fd61aa967a3719 charizard https://pokemon.actimel.de/welcome?scan=73e512eccd9639bf632f1675f6a34a116f0abe5404dcebe98bf023be0e329d10 blastoise https://pokemon.actimel.de/welcome?scan=9041324a9605633b12b6b65b4357af286cfad675ed5f5b1f1a564b27df821511 ivysaur https://pokemon.actimel.de/welcome?scan=1f29ed0b79a8582771992cb656ea38e9c6fb16215d85f99b72af43a0722e163b pawmi https://pokemon.actimel.de/welcome?scan=fa48a2842a0b0f8f5372bf347533edca563ba867851374bd3d0d632df066e3e1 pichu https://pokemon.actimel.de/welcome?scan=fc23f358d8c9f72c56e093af3877723bb7d0b1f9d786d815acddd37a35a1012b pikachu https://pokemon.actimel.de/welcome?scan=43999461d22f67840fcd9b8824293eaa4f18146e57b2c651bcd925e3b3e4e429 quaxly https://pokemon.actimel.de/welcome?scan=6339e380b97b2ee89170ff4dcc51e19d2b5881a58ac7475cf7bf5f5369dd6ecb smoliv https://pokemon.actimel.de/welcome?scan=d2b8de5e99f0dc7d8a207861a0dcded1de5a8a1ccd45c94828fb11565b2f1305 raichu https://pokemon.actimel.de/welcome?scan=a9462f7c66b5833710cbb41d4ef19e4bd704b05c69b94f1bafb2e9b15bae1217 sprigatito https://pokemon.actimel.de/welcome?scan=5a68b137ceecaa8397262b9701c5ba0ed0b9d63927e4e14c17f56cd871134f0c squirtle https://pokemon.actimel.de/welcome?scan=43c9d997f68ee54a55f7a22062c895312250751d3505ef2da40d2a7cf32b39fe venusaur https://pokemon.actimel.de/welcome?scan=74ac4c00f18fe573707f30310dc80ab513408e593b64b00c0cdfdfc3c174b370 wartortle https://pokemon.actimel.de/welcome?scan=eb2af329c8d993e4f8ada53717e945cf652428690b0ba68ef6030ca857a28eec Have fun 😉. ...

June 14, 2024 · 1 min · Daniel Hufschläger

Linkdump 26/2024

Sehr schönes online Tool zum Frickeln an SED-Ausdrücken: GNU sed REPL Kontrolle über S6 Services in Containern. S6-SVC Doku Wass ist Chat-GPT eigentlich und warum funktioniert es überhaupt? Stephen Wolfram

May 10, 2024 · 1 min · Daniel Hufschläger

Suche nach den ersten hundert Primzahlen in C++

Suchen der Primzahlen kleiner 100 in C++. // basic io #include <iostream> using namespace std; int main ( int argc, const char* argv[] ) { int iCount = 0; int iDivisor = 1; // loop over all natural numbers for ( iCount = 1; iCount <= 100; ++iCount ){ // state if current number is a prime number int iPrime = 1; // loop over each divisor candidate for ( iDivisor = 2; iDivisor < iCount; ++iDivisor ) { // if divisor matches the current number -> change state if ( iCount % iDivisor == 0 ){ iPrime = 0; } } // if prime print to stdout if (iPrime == 1 ) { std::cout << iCount << std::endl; } } return 0; }

October 9, 2020 · 1 min · Daniel Hufschläger

Atmel ICE and OS X no 4

For tinkering with an ATmega32U4 board, (again) I need to get the ATMEL ICE under macOS. Since High Sierra kernel extensions have to be signed and the presented workarounds of earlier posts wouldn’t work anymore. However, there is a signed kext available at the AVRFreaks forums. In my case, I downloaded the file, extracted and moved it. Additionally, I adjusted the owner and access rights. Since these files are system relevant files, you will need to do these operations as super-user. ...

May 20, 2018 · 1 min · Daniel Hufschläger

Setting Hugo frontmatter using Python

Recently I switched the theme of my blog (based on hugo). My new theme is supporting some new features like authors. This feature requires some additional parameters in the front matter of the post. I found a very convenient way using the Python package front matter. The code below changes these parameters automatically. The original script was posted in a StackOverflow answer but doesn’t work for me. So I modified it slightly. #!/usr/bin/env python # # https://stackoverflow.com/questions/25697664/how-would-i-parse-front-matter-with-python # import frontmatter import io from os.path import basename, splitext import glob auths = ['daniel'] path = "content/docs/*.md" for fname in glob.glob(path): with io.open(fname, 'r') as f: post = frontmatter.load(f) if post.get('author') == None: post['authors'] = auths newfile = io.open( fname, 'w', encoding='utf8') #frontmatter.dump(post, newfile) newfile.write ( frontmatter.dumps(post) ) newfile.close() The script above checks the existence of authors in all markdown files inside the predefined path. Contains the post an existing parameter it does nothing, is it missing it will be added automatically. Very convenient! ...

January 16, 2018 · 1 min · Daniel Hufschläger

Sublime Text 3 using miniconda

The conda package for Sublime Text 3 in default configuration is prefering Anaconda. Neverless by adjusting some paths, you’ll be able to use miniconda aswell. The source block below was taken for a installation of miniconda (with Python 3.6) x64 on a Windows workstation. The paths might be different on a macOS or Linux machine. // Default settings for sublime-text-conda: { // executable is the path to anaconda's python // this python executable is used in order to find conda "executable": "~\\AppData\\Local\\Continuum\\miniconda3\\python", // Directory in which the conda envs are stored // Default location is the user's home directory "environment_directory": "~\\AppData\\Local\\Continuum\\miniconda3\\envs\\", // configuration is the path to conda's configuration file "configuration": "~/.condarc" }

October 10, 2017 · 1 min · Daniel Hufschläger

Amplitude modulation and demodulation using Python

As the title promises, I have spent some time for recapitulating the amplitude modulation and several reconstruction techniques. Today amplitude modulation isn’t very common, but was used for varoius applications like audio or signal transmissions in general. Math The amplitude modulation uses a high frequency signal $U_{C}$ which carriers the low frequency signal $U_{NF}$ into a higher frequency band. $$ \begin{aligned} U_{NF} &= \hat{U}_{T} + \hat{U}_{NF} \cdot cos\left( \omega t \right)\\ U_{C} &= \hat{U}_{C} \cdot cos \left( \Omega t \right) \end{aligned}$$ ...

April 27, 2017 · 4 min · Daniel Hufschläger

Interfacing a MS8607 sensor with Python using the bus pirate

A couple of days ago, I’ve read about Scott Harden’s interesting approach of interfacing a twi temperature sensor by using Python and Hack-a-day’s bus pirate. Quite accidentally, I had an similar problem. For some experiments I need a good knowledge about my environmental sizes (e.g. ambient pressure, temperature and humidity). I decided to use a MS8607 sensor produced by “Measurement Specialities / TE Connectivity” and is distributed for example by AMSYS. I’ve got some modules and started reading the datasheet. Due a permanent lack of time I was searching for a good and simple way for testing the sensor interface without the whole prototype circus (e.g. design and build some interface cards, testing the code by using debug interfaces and so on). Scott’s solution was simple and I had all tools already available, so I started to adapt his code for my needs. ...

February 26, 2017 · 5 min · Daniel Hufschläger

CFD simulations using Scientific Python

Introduction For some simulation topics of my Ph.D., I had to learn/recapitulate some basics about simulations techniques and fluid simulations. The original procedure and code could be found at Archer (UK National Supercomputing Service). This is a simple example for applying the finite difference approach to determine the flow pattern (CFD1) in a cavity. For simplicity, we’re assuming a perfect liquid without viscosity, which also implies that there’re no vortices. The \(z\)-dimension of this setup was defined to be endless. We are interested in the directional velocity of the fluid. ...

December 18, 2016 · 4 min · Daniel Hufschläger