Skip to content

Instantly share code, notes, and snippets.

View bdx0's full-sized avatar

Dương Bảo Duy bdx0

View GitHub Profile
@bdx0
bdx0 / darwin.nix
Created January 12, 2025 13:01 — forked from r281GQ/darwin.nix
wezterm nixos
{ config, pkgs, ... }:
let
p = import ./test.nix;
pkgsM1 = import <nixpkgs> { overlays = []; };
inherit (import <nixpkgs> {}) fetchFromGitHub lib;
inherit (pkgsM1) ffmpeg imagemagick tmux zsh starship gnupg nodejs-14_x nodejs-16_x postgresql_13 rustup;
@bdx0
bdx0 / libvirtd-ops.md
Created October 10, 2024 16:00 — forked from jhillyerd/libvirtd-ops.md
Getting started with nixops and libvirtd

Enable libvirtd

Add:

virtualisation.libvirtd.enable = true;

and

users.users.<you>.extraGroups = [ "libvirtd" ];
@bdx0
bdx0 / libvirtd-ops.md
Created October 10, 2024 16:00 — forked from jhillyerd/libvirtd-ops.md
Getting started with nixops and libvirtd

Enable libvirtd

Add:

virtualisation.libvirtd.enable = true;

and

users.users.<you>.extraGroups = [ "libvirtd" ];
@bdx0
bdx0 / download_file.py
Created August 24, 2024 11:48 — forked from kissgyorgy/download_file.py
Python: Download file, get file size and Content type.
import requests
r = requests.get("http://download.thinkbroadband.com/10MB.zip",
cookies={'cookie1': 'working'}
)
open('10MB.zip', 'wb').write(r.content)
@bdx0
bdx0 / download_file.py
Created August 24, 2024 11:48 — forked from kissgyorgy/download_file.py
Python: Download file, get file size and Content type.
import requests
r = requests.get("http://download.thinkbroadband.com/10MB.zip",
cookies={'cookie1': 'working'}
)
open('10MB.zip', 'wb').write(r.content)
@bdx0
bdx0 / TorPrivoxyPython.md
Created August 12, 2024 08:07 — forked from DusanMadar/TorPrivoxyPython.md
A step-by-step guide how to use Python with Tor and Privoxy

A step-by-step guide how to use Python with Tor and Privoxy

Latest revision: 2021-12-05.

Tested on Ubuntu 18.04 Docker container. The Dockerfile is a single line FROM ubuntu:18.04. Alternatively, you can simply run docker run -it ubuntu:18.04 bash.

NOTE: stopping services didn't work for me for some reason. That's why there is kill $(pidof <service name>) after each failed service <service name> stop to kill it.

References

@bdx0
bdx0 / flake-direnv.md
Created August 9, 2024 17:24 — forked from inscapist/flake-direnv.md
Nix Flakes and Direnv on Mac OSX (Catalina)

Development environment with Nix Flakes and Direnv

This document is targeted at those who seek to build reproducible dev environment across machines, OS, and time.

It maybe easier for remote teams to work together and not spending hours each person setting up asdf/pyenv/rbenv, LSP servers, linters, runtime/libs. Nix is probably the closest thing to Docker in terms of development environment.

Flake is used here because it provides hermetic build, with absolutely no reliance on system environment (be it Arch/Catalina/Mojave). Also it freezes dependencies in flake.lock so builds are reproducible.

This gist provides the setup to develop Java/Clojure/Python applications on Nix. But it can be easily adapted to ruby, nodejs, haskell.

@bdx0
bdx0 / nixinst.sh
Created August 9, 2024 03:30 — forked from nuxeh/nixinst.sh
Automated NixOS installer script
#!/bin/sh
#
# For installing NixOS having booted from the minimal USB image.
#
# To run:
#
# sh -c "$(curl https://eipi.xyz/nixinst.sh)"
#
# https://eipi.xyz/blog/nixos-x86-64
@bdx0
bdx0 / remount.sh
Created August 8, 2024 11:33 — forked from ertseyhan/remount.sh
Temporarily increase size of tmp folder on Arch linux
#!/bin/bash
sudo mount -o remount,size=10G,noatime /tmp
echo "Done. Please use 'df -h' to make sure folder size is increased."

GPU + CUDA + Nvidia Driver set up

  • confirm gpu existence
$ apt-get install pciutils
$ lspci -nnk | grep -i nvidia
  • nvidia driver