Skip to content

Instantly share code, notes, and snippets.

View mazunki's full-sized avatar
📚
Doing university homework

Rolf Vidar Mazunki Hoksaas mazunki

📚
Doing university homework
View GitHub Profile
@mazunki
mazunki / network.md
Last active January 28, 2022 22:52
How to diagnose network problems

Help, I don't have access to the internet!

Okay, keep calm. Let's see what is going on.

You have probably seen this graph before:

OSI Model stack

You might know all about it, or not understand anything about it. Either is fine. The only thing you need to understand is that when you're connecting to the internet, you're peeling an onion: it has layers.

@mazunki
mazunki / screenshots.md
Last active January 7, 2022 23:05
Screenshots, they're not that hard

Your phone is a great tool to take pictures, we all know that... but please, don't use a phone to take a picture of your monitor

Your non-orthogonal angle is pain to look at, the text is blurry, the lighting is just messed up. If you want help, make us want to help you. Make our lives easier.

Besides, it's not even that hard to take screenshots. And you can usually just paste them in, without having to pick up your phone to send the message on whatever platform you're working on.

Windows

  • Windows has a built-in Snippet Tool. Pin it to your hotbar, or use <Logo key>+<Shift>+<S>.
  • Use the <PrintScreen> button on your keyboard. If your laptop doesn't have this button, you may use <Fn>+<Logo Key>+<Spacebar> instead.
  • Install a tool like ShareX which has a bunch of handy customization, including shortcuts to capture regions, windows, and even auto-post to Twitter.
@mazunki
mazunki / wofi-add-pre-display-cmd.patch
Created October 22, 2021 22:00
Adding support for --pre-display-cmd so one can run something like `ls /some/path | wofi --show dmenu --pre-display-cmd 'cat /some/path/%s', and output the original filename, while displaying the contents of the file in the entries
diff -r bae1c99a465f src/main.c
--- a/src/main.c Mon Feb 22 23:53:57 2021 -0800
+++ b/src/main.c Fri Oct 22 23:56:28 2021 +0200
@@ -96,6 +96,7 @@
printf("--gtk-dark\t-G\tUses the dark variant of the current GTK theme\n");
printf("--search\t-Q\tSearch for something immediately on open\n");
printf("--monitor\t-o\tSets the monitor to open on\n");
+ printf("--pre-display-cmd\t-r\tRuns command for the displayed entries, without changing the output. %%s for the real string\n");
exit(0);
}
@mazunki
mazunki / gist:5885e9e839bbbc0eda9434243edc0f3b
Created October 15, 2021 03:06
cookie clicker mazunki proton log
We couldn’t find that file to show.
@mazunki
mazunki / linux_get_external_addr.c
Created September 17, 2021 23:59
Get Gateway the "Linux way" through kernel polling
/*
Originally from https://gist.github.com/Yawning/c70d804d4b8ae78cc698, changed to include gateway
*/
#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <stdlib.h>
@mazunki
mazunki / README.md
Created December 25, 2017 01:38 — forked from seiyria/README.md
Common Pitfalls in JS-based Games

update: this post has been moved to my blog

Welcome! You might be reading this out of curiosity, or because you want to improve your programming capabilities to stop people from exploiting your JS games. Given that the first thing I do when I open a new incremental is open the terminal and start messing around with your games, I figured it's about time to write something about what I see and how I break your games. Consequently, I'll describe ways you can protect your games from the basic code manipulations I perform. Some might say "you're just ruining the game for yourself!" while I'm going to turn around and say "I don't care" -- that's not the point of this!

NB: This will only apply to vanilla JS applications, which I see more commonly. Frameworks like AngularJS and such are out of scope for this post. Advanced techniques such as using a debugger, while slightly more on topic, will also be disregarded for now.

Le

@mazunki
mazunki / README.md
Created December 25, 2017 01:38 — forked from seiyria/README.md
Common Pitfalls in JS-based Games

update: this post has been moved to my blog

Welcome! You might be reading this out of curiosity, or because you want to improve your programming capabilities to stop people from exploiting your JS games. Given that the first thing I do when I open a new incremental is open the terminal and start messing around with your games, I figured it's about time to write something about what I see and how I break your games. Consequently, I'll describe ways you can protect your games from the basic code manipulations I perform. Some might say "you're just ruining the game for yourself!" while I'm going to turn around and say "I don't care" -- that's not the point of this!

NB: This will only apply to vanilla JS applications, which I see more commonly. Frameworks like AngularJS and such are out of scope for this post. Advanced techniques such as using a debugger, while slightly more on topic, will also be disregarded for now.

Le