Testing a cheap MicroSD card quality

💾 Intro I just found a very cheap SD card on an online store and since I know that there are some fake around, I wanted to quickly test if its size and speed respect the specs. Edit: after first publish, a kind reader noticed me that The F3 tools are a perfect fit for the same task and that’s right; if you want to follow a manual path and learn something in the journey, continue reading… ...

September 3, 2024 · Andrea Manzini

migrating a repository from mercurial to git

Since bitbucket is sunsetting the support for mercurial repositories, I wrote a quick and dirty script to automate the migration from mercurial to GIT: #!/bin/bash set -e set -u if [ "$#" -ne 3 ]; then echo "Illegal number of parameters" echo "usage: migrate.sh reponame hgrepourl gitrepourl" exit 1 fi REPONAME=$1 HGURL=$2 GITURL=$3 echo "Migrating $REPONAME from $HGURL to $GITURL..." cd /tmp hg clone $HGURL cd $REPONAME hg bookmark -r default master hg bookmarks hg cd .. mv $REPONAME ${REPONAME}_hg mkdir ${REPONAME}_git cd ${REPONAME}_git git init --bare . cd ../${REPONAME}_hg hg push ../${REPONAME}_git cd ../${REPONAME}_git git remote add hgmigrate $GITURL git push hgmigrate master cd /tmp rm -rf /tmp/${REPONAME}_hg /tmp/${REPONAME}_git echo "...done" Before running the script, you only need to install git and create a git repository (remote or local). ...

December 15, 2019 · Andrea Manzini

linux: how to access DHCP options from client

As you may know, you can configure any DHCP server to send many options to the clients; for example to setup dns domains, http proxy (WPAD) and so on. If you need to access these options from a linux client, you must configure the client to ASK the server for the new options, by editing /etc/dhcp/dhclient.conf, and add an entry like: option WPAD code 252 = string; also request WPAD; done that, when you’ll ask for a dhcp, the dhclient process will invoke your hook scripts with two new environment variables, old_WPAD and new_WPAD, with the values before and after the renewal. ...

November 6, 2017 · Andrea Manzini

redirect output of an already running process

Long story short: you have launched your script/program but forgot to redirect the output to a file for later inspection. #!/usr/bin/python3 #sample endless running program that prints to stdout import time,datetime while True: print(datetime.datetime.now().time()) time.sleep(1) Using GNU Debugger you can re-attach to the process, then invoke the creation of a logfile and duplicate the file descriptor to make the system send the data to the new file, instead of the terminal: ...

April 24, 2015 · Andrea Manzini