Skip to content

Instantly share code, notes, and snippets.

@m-ou-se
m-ou-se / replace-debian-with-arch.txt
Last active January 30, 2025 05:03
Instructions to replace a live Debian installation with Arch
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/
wget 'ftp://ftp.nluug.nl/pub/os/Linux/distr/archlinux/iso/latest/archlinux-bootstrap-*-x86_64.tar.gz'
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1
@bkaradzic
bkaradzic / orthodoxc++.md
Last active April 4, 2025 07:46
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@calkan
calkan / gist:eaad0bc4458da16a72dd
Last active January 5, 2021 02:09
Michael Hoffman's crazy bash_history backer upper on git
1 - Create a *private* GitHub/Bitbucket or similar git repo. Here I assume the repo is:
https://github.com/calkan/bash_history.git
2 - Create .history directory and initialize it for the repo:
mkdir $HOME/.history
cd $HOME/.history
git init
touch README.md
# Has your OS/FS/disk lost your data?
# cd to the directory containing your project repositories and run the command
# below. (It's long; make sure you get it all.) It finds all of your git repos
# and runs paranoid fscks in them to check their integrity.
(set -e && find . -type d -and -iname '.git' | while read p; do (cd "$(dirname "$p")" && (set -x && git fsck --full --strict)); done) && echo "OK"
# I have 81 git repos in my ~/proj directory and had no errors.
@vpatryshev
vpatryshev / ZFC in Java
Created November 29, 2013 20:52
Wrote this code in July 2008, implementing ZFC set theory in Java. Kind of funny; it worked.
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Arrays;
import java.util.Map;
import java.util.IdentityHashMap;
import java.util.LinkedList;
import java.util.SortedSet;
import java.util.TreeSet;
@strake
strake / tcpsrv.c
Last active December 24, 2015 17:39
TCP server: spawn arguments with each connection on fds 0, 1
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
int setreuseaddr (int s, int v) {
@strake
strake / htgk.rc
Last active December 24, 2015 17:38
HyperText GateKeeper: All requests go to given CGI script.
#!/bin/rc
fn hdrs {
ifs='
' while ( x=`{ read | sed 's/:[ ]*/:/' } && ! ~ $#x 0) {
v=`{ echo $x | sed 's/:.*//' | tr - _ }
x=`{ echo $x | sed 's/^[^:]*:[ ]*//' }
HTTP_$v=$x
}
}
@igorburago
igorburago / xorab.c
Last active March 16, 2025 04:40
Finding all solutions of the equation x⊕(a-x)=b
// Copyright 2013 Igor Burago
// SPDX-License-Identifier: ISC
#include <limits.h>
#include <stdio.h>
static unsigned
enum_bit(unsigned q, unsigned x, unsigned *xs) {
if (q == 0) {
*xs = x;
@lecram
lecram / escher.py
Last active February 12, 2025 16:49
This is a toy one-file application to manage persistent key-value string data. The file is *both* the application and its data. When you run any of the commands described in `escher.py --help`, the file will be executed and, after data change, it will rewrite itself with updated data. You can copy the file with whatever name to create multiple d…
#! /usr/bin/env python
"""{escher} -- one-file key-value storage.
What?
This is a toy application to manage persistent key-value string data.
The file {escher} is *both* the application and its data.
When you run any of the commands below, the file will be executed and,
after data change, it will rewrite itself with updated data.
You can copy the file with whatever name to create multiple datasets.
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active April 3, 2025 13:20
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx