Error 407 when using git and a proxy with authentification

Recently I stumbled upon that kind of error when trying to update a submodule:

git submodule update –remote –merge
fatal: unable to access ‘https://github.com/DaveGamble/cJSON.git/’: Received HTTP code 407 from proxy after CONNECT

Turns out that it was the proxy authentification not being sent correctly.
In our case we are using system defined proxy, so we do not need git’s ones

Solved by using:


git config –global http.proxyAuthMethod ‘basic’
git config –global –unset http.proxy
git config –global –unset https.proxy

Some also encountered SSL verification problems due to auto signed certificate use in their network, and had to disable SSL verification. It’ done with the following command, but we do not recommend to use it unless really needed:

git config –global http.sslVerify false

Correctly print uint64_t / size_t in C

Have you even stumbled upon a strange warning when trying to print an uint64_t or a size_t ?
Do no take that warning lightly, as your code can break anytime if you’re not fixing it.

Warning example:

warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'uint64_t' [-Wformat]

To avoid the warning and crashes, you have to use a one of the PRIxxx macro which will choose the right way for your system to print the value, without crashes.
Example:

#include <inttypes.h>
uint64_t i;
printf("%"PRIu64"\n", i);

Macros for printf family can be found here.

New portapack mayhem app, Level app !

Level app interface

The level app is as simple as possible and allow you to monitor available level meters in a single view.
There is a live graph of each RSSI values and power level.

Link to Documentation

Link to official Nightly build

or click to download compiled version at the time of the post (bin only)

#hackrf #portapack #mayhem #level-app

Edit: it’s the hundredth post of that blog, yay !

KrampusHack2022: HellScape

I was tasked with the following wishlist:

  1. I like building, management, and systems that interact with each other.
  2. Space, robots, aliens!
  3. A game where violence isn’t front-and-center.
  4. Red is my favorite color.
  5. Music!

I wanted to make a robot game were you evade corroding fluids, which led me to fluid animation and Mathias Müller’s Ten Minutes Physics videos and tutorials (see https://matthias-research.github.io/pages/index.html)

I ended up only being able to port his Javascript demo to C, but here it is, and working (need allegro5 installed):

Video of the effect;

HellScape demo

UPDATE:

The last version in github is now a threaded processing version.

It’s way quicker.

I left both threaded and unthreaded functions in the sources.

How the same demo is looking now:

Last n_fluid version (threaded)

KrampusHack 2022 is opened !

KrampusHack 2022 is opened and starting on December 13 to December 31 !

goal. You are secret santa – create a surprising gift for a selected participant.
On Tuesday 13 December 2022, you will be assigned one of the other participants and you have to make your game as a gift for them (Once the competition starts, you can read here for whom you have to make a gift).

Everyone should post a wishlist of features that they would like to see in the game. Note this is a wishlist and not a requirement list – you should tune the game to your giftee, taking the wishlist as well as the person itself into account, and create something that is a nice and thoughtful surprise to them. To make your wish list easily findable, simply post it on your own log.

Rules: https://tins.amarillion.org/krampu22/rules

Join in and have fun with us ! https://tins.amarillion.org/join/

#tins #gamejam #hack #krampus #krampushack

Warnings from the compiler / linker

I was searching about a very specific warning that the gcc compiler started to sprout some few weeks ago:

That I extracted and translated from the original that was in French:

“/usr/bin/ld: warning: xxxxxxx.o: requires executable stack (because the .note.GNU-stack section is executable)”

And I stumbled upon that little gem page was one of the few to have a correct explanation:

https://www.redhat.com/en/blog/linkers-warnings-about-executable-stacks-and-segments

And also a few more here:
https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart

#gcc #compiler #linker #warning

Trick grep / egrep to always display filename

If you use grep / egrep on a single file, it will display the matched patterns, but not the filename nor the line number.

This can be boring in case you encapsulate a grep / egrep call inside i.e a find:

find ./mydir -type f -name '*.msg' -exec grep 'mysearch' {} \;

In that case it will only print the match and you will not know in which file.

The trick is to add a dummy filename as a second file to search. Doing so will trick grep / egrep into thinking you are searching in multiples files, thus displaying the filename on each match.
/dev/null is the perfect target for the second dummy file as it will never match anything.

Example:

find ./mydir -type f -name ‘*.msg’ -exec grep ‘mysearch’ {} /dev/null \;

Bonus / reminder:

In grep / egrep use the -n option to also display the match line number

Example:

find ./mydir -type f -name ‘*.msg’ -exec grep -n ‘mysearch’ {} /dev/null \;

#sysadmin #tips #tricks #grep #egrep

Git remove commit from a pushed pull request

If ever you have to remove a commit from a pushed pull request, here is a simple way to do it. Bonus: it’s not adding a commit for the removal.

First be sure to be on the good branch

git checkout target-pull-request-branch

Then have a watch at the PRs commit tab and note the commits hash you want to remove (one or more)

Replace X by that number in the following command, which will make and interactive rebase for the X last commits

git rebase -i HEAD~X

You are now going to have an interactive text view, in which all the aimed commits are preceded by the word ‘pick’

Using the view like a text editor, replace the ‘pick’ word by ‘drop’ on the lines containing the targeted commit’s hashes .

Exemple

Replaced pick with drop for commits 4aa3149 and 2031a79b:


Save and exit

In my case vim was the default text editor, so here you go escape colon w q

Push force the rebased repository

git push --force

This will remove the targeted commits and the only trace will be in the PR comments. The commit page will look like the rebased one, without the discarded commits nor a mention to them.