Skip to content

Instantly share code, notes, and snippets.

View NWuensche's full-sized avatar

NWuensche NWuensche

View GitHub Profile
@NWuensche
NWuensche / pseudoquine.sh
Created April 12, 2023 17:00
Bash-Script that almost writes itself. To demonstrate that bash scripts are written line by line
#!/bin/sh
#Program that almost writes itself into itself (but not quite), demonstrate that bash is executed line by line rather than whole file
CURR_FILENAME=$0
echo "Hello World"
sed -n '5,6 p' $CURR_FILENAME >> $CURR_FILENAME #Write 4th and 5th line into same file (i.e. echo + sed)
# sda1 -> boot 220MB
# sda2 -> / 120GB
# sda3 -> /swap 8GB
# sda4 -> /home 110GB
sed -e 's/\s*\([+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/sda
o # clear current table (root)
n # new partition (boot)
p # primary
1 # number 1
# default - start at beginning of disk
#!/bin/sh
MARKT_LAST_CHANGE=$(wget -q -O- https://wo-ist-markt.de/cities/berlin.json | sed -n 's/.*aktualisiert am \(.*\)",/\1/p')
BERLIN_LAST_CHANGE=$(wget -q -O- https://daten.berlin.de/datensaetze/wochen-und-tr%C3%B6delm%C3%A4rkte-0 | sed -n '/.*Aktualisiert.*/,$p' | sed -e '/.*end.*/,$d' | sed -n 's/.*<span .*>\(.*\)<\/span.*/\1/p')
if [[ "$MARKT_LAST_CHANGE" != "$BERLIN_LAST_CHANGE" ]]; then
echo "Dates don't match!"
#TODO Send E-Mail here
exit 1;
fi
# This module defines a small NixOS installation CD. It does not
# contain any graphical stuff.
{config, pkgs, ...}:
{
imports = [
# <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix>
# Provide an initial copy of the NixOS channel so that the user
# doesn't need to run "nix-channel --update" first.
map d closeTab
map O :bookmarks<Space>
map M createBookmark
map o :tabnew<Space>
map u :restore <Space>
map <C-f> scrollPageDown
map <C-b> scrollPageUp
systemd.timers.lowbatterytimer.timerConfig = {
OnBootSec="0h";
OnUnitInactiveSec="5min";
};
systemd.services.lowbatterytimer = {
serviceConfig = {
Type = "oneshot";
ExecStart = "/run/wrappers/bin/lowbattery";
};
enable = true;
windowManager.i3.configFile = let original = builtins.readFile /home/nwuensche/.i3/config; wallpaper = pkgs.fetchurl {
url = "https://i.pinimg.com/originals/02/fd/92/02fd92edf03b167382be63790ada0d20.jpg";
sha256 = "1xbmqmm0clnfialj5f8w1g85ivdszr1ih40qxpfrj1nn0rkl9pv3";
}; fehSnippet = "exec_always --no-background-id ${pkgs.feh}/bin/feh --bg-scale ${wallpaper}; in pkgs.writeText "config" (original + fehSnippet);
{pkgs, stdenv, gcc, zlib, lib}:
stdenv.mkDerivation rec {
name = "Planescape-Enhanced";
src = ./install.sh;
unpackPhase = "true";
installPhase = ''
set -x
mkdir -p $out
@NWuensche
NWuensche / output
Last active September 8, 2017 10:57
installing ‘Planescape-Enhanced’
warning: dumping very large path (> 256 MiB); this may run out of memory
these derivations will be built:
/nix/store/q1ddwk6cm08y8slw512ia4jf64896zfm-Planescape-Enhanced.drv
building path(s) ‘/nix/store/7rgd36wvn4svp8i2nwbmnlzr9wikislk-Planescape-Enhanced’
unpacking sources
patching sources
configuring
no configure script, doing nothing
building
{pkgs, stdenv}:
stdenv.mkDerivation rec {
name = "Planescape-Enhanced";
src = ./install.sh;
unpackPhase = "true";
installPhase = ''
mkdir -p $out