Skip to content

Instantly share code, notes, and snippets.

View carnotweat's full-sized avatar

sameer gupta carnotweat

View GitHub Profile
@carnotweat
carnotweat / 01_NixOS_Prefix_delegation_with_fixed_DUID.md
Created June 23, 2024 10:08 — forked from gleber/01_NixOS_Prefix_delegation_with_fixed_DUID.md
Configuring ipv6 with dhcpcd using static DUID in NixOS 17.03 (e.g. on online.net servers)

I was trying to configure native ipv6 on my NixOS box, which is running in online.net's datacenters. They provide you a /48 or smaller subnet and a DUID which is used during DHCP. In dhcpcd vocabulary DUID is called clientid.

online.net's help page about IPv6 configuration was not very useful, since NixOS uses dhcpcd by default. The page which allowed me to make it all work was https://community.online.net/t/tutorial-ipv6-with-dhcpcd/3804

It looks like the only really required entries in networking.dhcpcd.extraConfig are interface and static though. I assumed that clientid is also necessary, but it looks like dhcpcd cares much more about content of /etc/dhcpcd.duid. Of course replace enp2s0 with the name of the main interface.

{
description = "A very basic flake";
inputs.nixpkgs.url = github:nixos/nixpkgs/21.11;
inputs.flake-utils.url = github:numtide/flake-utils;
inputs.llvm-repo = {
flake = false;
# url = github:llvm/llvm-project?ref=a6d081b2cbc3348ed7261254ae7a563146b76d23;
url = github:llvm/llvm-project?ref=d7b669b3a30345cfcdb2fde2af6f48aa4b94845d; # 13.0.0
@siraben
siraben / tagless-final-concat.hs
Created December 19, 2020 04:05
Tagless final concatenative programming
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleInstances #-}
import Prelude (Bool,Show, (+))
import qualified Prelude as P
import Control.Arrow
import Control.Monad
import Control.Category
data s :. a = s :. a
@hedning
hedning / gnome-shell-record.py
Created January 18, 2020 14:21
Start gnome shell screen cast from command line
#!/usr/bin/env nix-shell
#! nix-shell -i python3 -p python3.pkgs.dbus-python
import dbus
import time
bus = dbus.SessionBus()
obj = bus.get_object("org.gnome.Shell", "/org/gnome/Shell/Screencast")
obj.Screencast("Auto %d %t.webm", [],
dbus_interface="org.gnome.Shell.Screencast")
@AndrasKovacs
AndrasKovacs / Ordinals.agda
Last active July 27, 2024 06:34
Large countable ordinals and numbers in Agda
{-# OPTIONS --postfix-projections --without-K --safe #-}
{-
Large countable ordinals in Agda. For examples, see the bottom of this file.
Checked with Agda 2.6.0.1.
Countable ordinals are useful in "big number" contests, because they
can be directly converted into fast-growing ℕ → ℕ functions via the
fast-growing hierarchy:
@chandraratnam
chandraratnam / mutt_mbsync_multipleaccounts.md
Last active October 18, 2024 00:17
Mutt + isync mbsync + gmail + multiple accounts.

Mutt + isync multiple accounts Unfinished

This is the setup that I use for mutt, I have two google domain account (read as gmail) and an institution where I work and study account. This means I have two gmail accounts and one outlook 365 account that i want to sync and read via mutt.

I want to store all my email locally as I travel a lot and will be in countries without easy internet access. For this I use mbsync (iSync). As it can handle multiple account types easily and efficently.

The setup works this way

[Remote Mail Servers] <= mbsync => [Local Mail Folders]

anonymous
anonymous / Porson font.md
Created July 8, 2017 20:49
Porson font

File: Download Porson font   Porson is a typeface in the Greek alphabet based on the handwriting of the English classicist Richard Porson, who, as his biographer writes, "excelled in writing sources for foreign language fonts. download SPIonic and other greek, hebrew, navajo, and foreign language fonts Porson Free Icon. Svg Vector Icons : Use of these fonts onany platform other than that for which it was originallyintended is not recommended and invalidates any OpenType fonts can include an expanded character set and layout features, providing broader linguistic support and more precise typographic control. Download Porson Greek OUP Two, font family Porson Greek OUP Two by with Regular weight and style, download file name is porson-greek-oup-two.ttf ----- GFS Porson for LaTeX

;; Bootstrap packages.
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(package-initialize)
(if (not (package-installed-p 'use-package))
(progn
@swlaschin
swlaschin / ConstrainedTypesExamples.fsx
Last active November 5, 2024 23:28
Examples of creating constrained types in F#
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").
#!/usr/bin/env bash
SED_SCRIPT=`echo '{\
s/_\\$/$/g;\
s/\\$BP\\$/\&/g;\
s/\\$SP\\$/\@/g;\
s/\\$LT\\$/</g;\
s/\\$GT\\$/>/g;\
s/\\$LP\\$/(/g;\
s/\\$RP\\$/)/g;\
s/\\$RF\\$/\\&/g;\