Skip to content

Instantly share code, notes, and snippets.

View AleXoundOS's full-sized avatar

AleXoundOS

  • Tbilisi, Georgia
  • 18:56 (UTC +04:00)
View GitHub Profile
@nazarewk
nazarewk / README.md
Created October 26, 2023 12:35
Standalone Nix module for modelling JSON data

This is an example of a standalone single-file module that outputs a JSON file out of it's configuration.

Standalone in this context means it's not meant to be used by NixOS or Home Manager configurations.

@AleXoundOS
AleXoundOS / MqttPublish.hs
Last active February 13, 2024 03:10
simple MQTT publish/subscribe over TLS shebang programs written in Haskell
#! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/cbe419ed4c8f98bd82d169c321d339ea30904f1f.tar.gz --tarball-ttl 4294967295
#! nix-shell -p "haskellPackages.ghcWithPackages (p: with p; [net-mqtt data-default])"
#! nix-shell -i "runhaskell -Wall"
-- This program builds itself and publishes given message to MQTT broker.
-- Copyright (C) 2024 Alexander Tomokhov
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@Scherso
Scherso / xmonadwinefix.md
Last active February 11, 2023 19:28
Fix for the "Wine System Tray" appearing on XMonad when using Wine.

Wine System Tray Fix for Xmonad

If you have used Xmonad and Wine on any Windows applications, you have probably noticed a window popping up with a logo of the app you're using. Here's a fix.

  • Firsty, find your xmonad.hs file, and edit it with your editor of choice.
@GuillaumeDesforges
GuillaumeDesforges / nixos_python_patch_venv_bins.md
Last active February 11, 2024 00:54
How to: make Python dependencies installed via pip work on NixOS

EDIT: check out fix-python instead, make Python run "as usual" on NixOS!

How to: make Python dependencies installed via pip work on NixOS

The issue

  • You are using NixOS
  • You start working on a Python project
  • You manage the dependencies in a classic Python virtual environment using pip or poetry
@luochen1990
luochen1990 / venv-py37.nix
Last active November 4, 2024 13:35
Nix Script to simulate FHS environment with python3 & pip & venv
#!/usr/bin/env -S bash -c 'nix-shell --pure $0 -A env'
# Usage:
# 1. run directly to enter bash (inside venv): `./venv-py37.nix`
# 2. build a standalone executable: `nix bundle -f ./venv-py37.nix` #this not works yet since it cause nested `unshare -U` call
# 3. run bash with extra arguments: `nix run -f ./venv-py37.nix '' -- -c 'python --version'`
# More:
# 1. commit id of nixpkgs can be found here: https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=python3
let
@udf
udf / write_up.md
Last active November 13, 2024 05:44
A Trick To Use mkMerge at The Top Level of a NixOS module

The Setup

I wanted to write a module that generates multiple systemd services and timers to scrub some zfs pools at certain intervals. The default scrub config does not support individual scrub intervals for each pool.

I want the config to look like this:

{
  services.zfs-auto-scrub = {
 tank = "Sat *-*-* 00:00:00";
@astynax
astynax / Basic.kt
Last active November 15, 2021 21:51
Made just for fun the BASIC-like DSL in Kotlin
class Basic {
data class Var(val name: String)
class Let {
infix fun BE(value: Any): Binding = TODO()
}
class Binding {
infix fun MOD(other: Any): Binding = TODO()
}
@Agnishom
Agnishom / Board.hs
Created November 7, 2021 14:21
Haskell Tic Tac Toe with CLI and Gloss GUI
module Board where
import Data.Map (Map, (!))
import qualified Data.Map as Map
import Data.List (intercalate)
data Player = X | O
deriving (Eq, Ord, Show)
newtype Board = Board (Map (Int, Int) (Maybe Player))
@AleXoundOS
AleXoundOS / patchwork4.hs
Last active April 6, 2023 13:28
haskell-diagrams simple patchwork 4
#! /usr/bin/env nix-shell
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [ diagrams-cairo (diagrams.overrideAttrs (def: { buildInputs = def.buildInputs ++ [ diagrams-cairo ]; configureFlags = def.configureFlags ++ [ \"-f cairo\" ]; })) ])"
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
-- import Diagrams.Backend.SVG.CmdLine
import Diagrams.Backend.Cairo.CmdLine
import Diagrams.Prelude