Skip to content

Instantly share code, notes, and snippets.

View crisidev's full-sized avatar
🦀

Matteo Bigoi crisidev

🦀
View GitHub Profile
@radiantly
radiantly / noMangleGoogle.user.js
Last active December 28, 2023 04:31
Prevent Google from mangling links on the search results when clicking or copying on Firefox
// ==UserScript==
// @name Prevent link mangling on Google
// @namespace LordBusiness.LMG
// @match https://www.google.com/search
// @grant none
// @version 1.1
// @author radiantly
// @description Prevent google from mangling the link when copying or clicking the link on Firefox
// ==/UserScript==
@the6p4c
the6p4c / cursed.c
Created August 27, 2020 02:23
hey! don't do this!
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/io.h>
#include <sys/mman.h>
#include "elf.h"
# import nothing
"""
Tested in cpython 3.6, 3.8 (from the arch repos) on 64-bit arch linux
"""
nullfunc = lambda: None
#from types import CodeType, FunctionType
CodeType = nullfunc.__code__.__class__
FunctionType = nullfunc.__class__
@epilys
epilys / dump_core.rs
Created March 12, 2020 06:26
easy core dump on panic in rust for debugging
pub fn register_panic_handler() {
let default_panic = std::panic::take_hook();
std::panic::set_hook(Box::new(move |panic_info| {
default_panic(panic_info);
// Don't forget to enable core dumps on your shell with eg `ulimit -c unlimited`
let pid = std::process::id();
eprintln!("dumping core for pid {}", std::process::id());
@russjones
russjones / run.sh
Last active September 23, 2022 14:57
A script to demonstrate Teleport Enhanced Session Recording.
#!/bin/bash
set -euo pipefail
RELEASE="teleport-v4.2.3-linux-amd64-bin.tar.gz"
if [[ $EUID -ne 0 ]]; then
echo "--> Please run this script as root or sudo."
exit 1
fi
@zottelbeyer
zottelbeyer / setup.sh
Last active April 3, 2024 20:08
ipv6 on docker-pihole
# enable ipv6 in dockerd conf:
# cat /etc/docker/daemon.json
{
"ipv6": true,
"fixed-cidr-v6": "2003::/64" # your ipv6. not sure if this is even necessary
}
# reload daemon conf:
sudo systemctl reload docker.service
@cengiz-io
cengiz-io / 99-disable-wireless-when-wired
Last active October 9, 2023 16:36
Script should be placed under `/etc/NetworkManager/dispatcher.d/` with a name like `99-disable-wireless-when-wired`. Make sure 1) root owns it 2) it's mod is 755
#!/bin/sh
IFACE=$1
ACTION=$2
ntfy () {
sudo -u cengiz \
DISPLAY=:0 \
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus \
notify-send "$1" "$2"
@munificent
munificent / generate.c
Last active May 1, 2024 20:06
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
# Modified from https://github.com/alyssais configuration.
#
# The following configuration heavily leverages modal keymaps to minimize the
# pollution of global keybindings. In addition, the modal keymaps facilitate
# the consistent use of the same keybindings across different modes. For
# example, this configuration uses 'h', 'l', 'j', and 'k' to represent west,
# east, south, and north when: changing focus, warping windows, resizing
# windows, swapping windows, and moving floating windows. Those four keys are
# mapped differently depending on the current mode to provide a consistent user
# experience.
@romainl
romainl / dynaline.gif
Last active March 20, 2024 10:11
How to add dynamic highlighted parts to your status-line
dynaline.gif