Skip to content

Instantly share code, notes, and snippets.

@gauravjuvekar
gauravjuvekar / mount-nix.sh
Last active November 18, 2023 00:05
mount-nix.sh
modprobe dm_raid
modprobe dm_integrity
vgchange --config 'devices { scan_lvs = 1 }' -ay
cryptsetup open /dev/mapper/vgBoot-lvBoot cryptBoot
cryptsetup open /dev/mapper/vgRaid-lvRaid cryptPv
vgchange --config 'devices { scan_lvs = 1 }' -ay
mount /dev/mapper/vgOs-nixRoot /mnt -o subvol=@root
mount /dev/mapper/vgOs-nixRoot /mnt/nix -o subvol=@nix
mount /dev/mapper/vgOs-lvHome /mnt/home -o subvol=@home
mount /dev/mapper/cryptBoot /mnt/boot
{ config, pkgs, ... }:
{
imports = [ <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix> ];
systemd.services."xe-daemon".enable = false;
environment.etc."lvm/lvm.conf" = {
text = ''
devices {
{
"section1": {
"type": "section",
"description": "Behavior"
},
"show-all-workspaces": {
"type": "switch",
"default": false,
"description": "Show windows from all workspaces",
"value": false
{
"buildDir": "/home/pkgbuilder/.cache/yay",
"editor": "",
"editorflags": "",
"makepkgbin": "makepkg",
"pacmanbin": "pacman",
"pacmanconf": "/etc/pacman.conf",
"tarbin": "bsdtar",
"redownload": "no",
"rebuild": "no",
################################################################################
################# Arch Linux mirrorlist generated by Reflector #################
################################################################################
# With: reflector --protocol https --latest 100 --number 20 --sort rate --save /etc/pacman.d/mirrorlist
# When: 2019-05-11 04:40:48 UTC
# From: https://www.archlinux.org/mirrors/status/json/
# Retrieved: 2019-05-11 04:40:24 UTC
# Last Check: 2019-05-11 04:34:03 UTC
-- Logs begin at Thu 2018-12-20 02:50:23 UTC, end at Thu 2018-12-20 02:54:13 UTC. --
Dec 20 02:50:23 archlinux kernel: microcode: microcode updated early to revision 0x24, date = 2018-04-02
Dec 20 02:50:23 archlinux kernel: Linux version 4.19.9-arch1-1-ARCH (builduser@heftig-14263) (gcc version 8.2.1 20181127 (GCC)) #1 SMP PREEMPT Fri Dec 14 00:58:26 UTC 2018
Dec 20 02:50:23 archlinux kernel: Command line: BOOT_IMAGE=/vmlinuz-linux root=/dev/mapper/os_VG-arch_root rw rd.luks.name=29330039-8a29-4b44-bc94-0b749e732abd=crypt_PV rd.luks.options=discard root=UUID=6f784280-161b-4866-9eaa-0d8bd2967b0d resume=UUID=878ee225-bd99-4472-b264-8c08c3eb5ab8 sysrq_always_enabled=1 debug
Dec 20 02:50:23 archlinux kernel: KERNEL supported cpus:
Dec 20 02:50:23 archlinux kernel: Intel GenuineIntel
Dec 20 02:50:23 archlinux kernel: AMD AuthenticAMD
Dec 20 02:50:23 archlinux kernel: Centaur CentaurHauls
Dec 20 02:50:23 archlinux kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
Dec 20 02:50:23
@gauravjuvekar
gauravjuvekar / parse_depends.py
Created December 17, 2017 12:45
ParseDepends SCons tool
"""
Use the C preprocessor to generate include dependencies
The SCons ParseDepends can parse the dependency files output by the
preprocessor, however this requires a rebuild as the dependency files are
updated after the compiler is run once.
See the `-M` flags in `man gcc` for more info.
This implementation was taken from
https://bitbucket.org/scons/scons/wiki/ParseDepends
@gauravjuvekar
gauravjuvekar / log_config.py
Created July 11, 2017 05:45
logging config with verboselogs and coloredlogs
#!/usr/bin/env python3
"""
Easliy set up a consistent logging configuration for all codes that use this
library.
The main code can be written as:
import logging
import coloredlogs
import argparse
#!/usr/bin/env python3
import numpy as np
import cv2
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
def detect(img, cascade):
rects = cascade.detectMultiScale(img, scaleFactor=1.3, minNeighbors=4, minSize=(30, 30),
flags=cv2.CASCADE_SCALE_IMAGE)