Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
disp_num="${DISPLAY/:/}"
systemctl --user start gnome-terminal-server@"$disp_num".service
exec /usr/bin/gnome-terminal --app-id org.gnome.Terminal.X"$disp_num"
@tomty89
tomty89 / fib_daddr_nat
Last active June 8, 2022 18:23
alternate approach to actually protect LAN hosts (from "WAN LAN" hosts) on a gateway (NAT != secure)
# not sure if raw or mangle makes more sense, but it seem to work fine as long as it's no "later" than dstnat
type filter hook prerouting priority dstnat; policy accept;
# the ". iif" part is probably irrelevant for this case,
# it should probably be removed if the "usual" behavior of the input traffics needs to be retained
# if it's for a "real" WAN, it might be desirable to also drop multicast (and even broadcast?) traffics
iifname "$WAN" fib daddr . iif type != { local, broadcast, multicast } drop
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define B 4
static unsigned char* ntb(unsigned char b[], unsigned int n) {
b[0] = n >> 24;
b[1] = n >> 16;
b[2] = n >> 8;
[Unit]
Description=dnsmasq - A lightweight DHCP and caching DNS server
Documentation=man:dnsmasq(8)
BindsTo=netns-temp.service
After=network.target netns-temp.service
Before=network-online.target nss-lookup.target
Wants=nss-lookup.target
[Service]
NetworkNamespacePath=/run/netns/temp
@tomty89
tomty89 / dhcp0.conf
Created February 1, 2022 11:28
dhcp0
port=0
dhcp-range=192.168.150.2,192.168.150.252
dhcp-option=option:router,192.168.150.1
dhcp-option=option:dns-server,192.168.150.1
load -nc %homefilesystem%\NvmExpressDxe.efi
connect -r
%homefilesystem%\EFI\arch\grubx64.efi
alias 1920='echo Xft.dpi: 144 | xrdb; xrandr --output screen --mode 1920x1080; i3-msg restart'
alias 2560='echo Xft.dpi: 192 | xrdb; xrandr --output screen --mode 2560x1600; i3-msg restart'
class A {
private int a;
// private int b;
int b;
// private void aa() {
// a++;
// }
@tomty89
tomty89 / Huh.java
Created November 27, 2021 02:04
An attempt to differentiate object instance and reference
class Meh {
@Override
protected void finalize() {
try {
super.finalize();
} catch (Throwable e) {
;
}
System.out.println("\"" + this + "\" " + "destroyed");
}
@tomty89
tomty89 / Meh.java
Last active November 20, 2021 06:20
Example to clarify re-assignment of references
class Huh {
public int huh;
public Huh() {
huh = 123;
}
}
public class Meh {
// Re-implement "toString()" for String