Skip to content

Instantly share code, notes, and snippets.

View KoviRobi's full-sized avatar

Kovacsics Robert KoviRobi

  • Cambridge Consultants
  • Cambridge, UK
  • 10:28 (UTC +01:00)
View GitHub Profile
@KoviRobi
KoviRobi / nixos-container.nix
Last active June 7, 2023 11:11
NixOS container example, for a web browser container. Use "sudo systemctl start container@browser" to start.
# vim: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent syntax=nix nocompatible :
# Containers
{ config, pkgs, ... }:
{ containers.browser =
let hostAddr = "192.168.100.10";
in
{ privateNetwork = true;
hostAddress = hostAddr;
@KoviRobi
KoviRobi / nixos-container-launch.sh
Created December 17, 2014 17:49
This accompanies nixos-container.nix
#!/bin/sh -xeu
restart="false";
echo $#
if [ "$#" -ge 1 ]; then
case "$1" in
"r"|"re"|"res"|"rest"|"resta"|"restar"|"restart")
sudo systemctl stop container@browser
restart="true";
;;
downloading Nix 2.3.3 binary tarball for x86_64-linux from 'https://nixos.org/releases/nix/nix-2.3.3/nix-2.3.3-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.DNen1PENRW'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 86 100 86 0 0 858 0 --:--:-- --:--:-- --:--:-- 860
100 16.4M 100 16.4M 0 0 95.5M 0 --:--:-- --:--:-- --:--:-- 95.5M
Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation
Switching to the Daemon-based Installer
Welcome to the Multi-User Nix Installation

This installation tool will set up your computer with the Nix package
downloading Nix 2.3.3 binary tarball for x86_64-linux from 'https://nixos.org/releases/nix/nix-2.3.3/nix-2.3.3-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.4U1lpLFhC6'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 86 100 86 0 0 725 0 --:--:-- --:--:-- --:--:-- 728
100 16.4M 100 16.4M 0 0 87.7M 0 --:--:-- --:--:-- --:--:-- 87.7M
Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation
Switching to the Daemon-based Installer
Welcome to the Multi-User Nix Installation

This installation tool will set up your computer with the Nix package
{ nixpkgs ? import <nixpkgs> {}
}:
with nixpkgs;
stdenv.mkDerivation {
name = "connectal";
version = "1.0.0";
buildInputs = [
bluespec
strace
which: no quartus_sh in (/nix/store/kp60cyq5iig35gzp7l2pr0ilxxa4m919-bash-interactive-4.4-p23/bin:/nix/store/mwfy3ihfydvrjmsimbd2kkr20n9abqsv-patchelf-0.9/bin:/nix/store/1wb31gzrjw055xl6d3igzj1gnajzlwbk-gcc-wrapper-9.2.0/bin:/nix/store/gh9a48qcwzw588vy4w72w93kad0mhhi8-gcc-9.2.0/bin:/nix/store/c2lx3lsqp0y5kwvwkqma8iihc7xjj1m8-glibc-2.30-bin/bin:/nix/store/hzvl3dvv8651iqlb5g6gq5hzjzmhjn7m-coreutils-8.31/bin:/nix/store/ahfsyzh84splz1p5ryj9j1isqgm5739b-binutils-wrapper-2.31.1/bin:/nix/store/nfs9wf6ipffr9g9ylzb4i9c1i607nxvq-binutils-2.31.1/bin:/nix/store/c2lx3lsqp0y5kwvwkqma8iihc7xjj1m8-glibc-2.30-bin/bin:/nix/store/hzvl3dvv8651iqlb5g6gq5hzjzmhjn7m-coreutils-8.31/bin:/nix/store/2vxm66aq8f580x90z6nwc4iglm3ahijh-bluespec-unstable-2020.02.09/bin:/nix/store/im6zg1fqr7fp0q9fmj56p3zacvv36ys9-strace-5.5/bin:/nix/store/78m6fpsrczklmscgy55hxlyfwzwpylab-python-2.7.17-env/bin:/nix/store/hzvl3dvv8651iqlb5g6gq5hzjzmhjn7m-coreutils-8.31/bin:/nix/store/rphcpivxfm4blw36ki262yrmqygw9pcp-findutils-4.7.0/bin:/nix/store/h3bhvh06cf03l
grep: /home/rmk35/programming/bluespec/connectal/boardinfo/.json: No such file or directory
which: no quartus_sh in (/nix/store/kp60cyq5iig35gzp7l2pr0ilxxa4m919-bash-interactive-4.4-p23/bin:/nix/store/mwfy3ihfydvrjmsimbd2kkr20n9abqsv-patchelf-0.9/bin:/nix/store/1wb31gzrjw055xl6d3igzj1gnajzlwbk-gcc-wrapper-9.2.0/bin:/nix/store/gh9a48qcwzw588vy4w72w93kad0mhhi8-gcc-9.2.0/bin:/nix/store/c2lx3lsqp0y5kwvwkqma8iihc7xjj1m8-glibc-2.30-bin/bin:/nix/store/hzvl3dvv8651iqlb5g6gq5hzjzmhjn7m-coreutils-8.31/bin:/nix/store/ahfsyzh84splz1p5ryj9j1isqgm5739b-binutils-wrapper-2.31.1/bin:/nix/store/nfs9wf6ipffr9g9ylzb4i9c1i607nxvq-binutils-2.31.1/bin:/nix/store/c2lx3lsqp0y5kwvwkqma8iihc7xjj1m8-glibc-2.30-bin/bin:/nix/store/hzvl3dvv8651iqlb5g6gq5hzjzmhjn7m-coreutils-8.31/bin:/nix/store/2vxm66aq8f580x90z6nwc4iglm3ahijh-bluespec-unstable-2020.02.09/bin:/nix/store/im6zg1fqr7fp0q9fmj56p3zacvv36ys9-strace-5.5/bin:/nix/store/78m6fpsrczklmscgy55hxlyfwzwpylab-python-2.7.17-env/bin:/nix/store/hzvl3dvv8651iqlb5g6gq5hzjzmhjn7m-coreutils-8.31/
#!/usr/bin/env nix-shell
#! nix-shell -i python -p "(python3.withPackages (p: with p; [ pysrt ]))"
import pysrt
import re
regexp = re.compile(r'\bring\b', flags=re.I)
filename='LOTR1.srt'
subs = pysrt.open(filename)
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch-git
# vim:ft=sh:
set -euo pipefail
if [[ "${#}" -lt 1 ]]; then
echo "USAGE: nixify <path> [rev]"
echo "Path must exist and must be a directory"
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#include "sendchar.h"
#include "virtser.h"
#define BASE 0 // Default layer
#define MIRROR 1 // Mirrored
#define SYMBOLS 2 // Symbols
#define NUMPAD 3 // Number pad