Skip to content

Instantly share code, notes, and snippets.

View uskudnik's full-sized avatar

Urban Škudnik uskudnik

View GitHub Profile
@uskudnik
uskudnik / nixos-on-dell-9560.org
Created September 5, 2020 13:59 — forked from domenkozar/nixos-on-dell-9560.org
NixOS on a Dell 15" 9560 with the 4K screen.
services.openvpn.servers.example = {
config = someconfighere;
autoStart = true;
up = ''
echo nameserver $nameserver | ${pkgs.openresolv}/bin/resolvconf -a $dev
'';
down = ''
echo nameserver $nameserver | ${pkgs.openresolv}/bin/resolvconf -d $dev
'';
};
@uskudnik
uskudnik / gevent-failed-compiling.sh
Created February 17, 2018 18:10
Gevent fails to compile on OSX
# requirements.txt
gevent==1.2.0
# compile run
pypi2nix -v \
-V 2.7 \
-r requirements.txt
pypi2nix v1.8.1 running ...
@uskudnik
uskudnik / pynacl.sh
Created January 8, 2018 17:56
pynacl-nix-example
$ cat shell.nix
let channels = rec {
pkgs = import <nixpkgs> {};
pkgs-unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) {};
};
in with channels;
let dependencies = rec {
_python = pkgs.python27Full;
_pip = pkgs.python27Packages.pip;
@uskudnik
uskudnik / configuration.nix
Created December 8, 2017 18:04
Aliasing with overlays
{ config, pkgs, ... }:
let channels = rec {
pkgs-unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) { config.allowUnfree = true; };
pkgs-master = import (fetchTarball https://github.com/NixOs/nixpkgs/archive/master.tar.gz) {
config.allowUnfree = true;
overlays = [
(self: super: {
firefox-master = super.firefox.override {
browserName = "firefox";
@uskudnik
uskudnik / conf.nix
Last active November 29, 2017 13:26
configuration.nix
{ config, pkgs, ... }:
let channels = rec {
pkgs-unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) { config.allowUnfree = true; };
pkgs-master = import (fetchTarball https://github.com/NixOs/nixpkgs/archive/master.tar.gz) { config.allowUnfree = true; };
};
in with channels;
...
@uskudnik
uskudnik / algebraic-types-phone.hs
Created June 26, 2017 20:35
smsing like in the old days
import Data.Char
import Data.List
import Data.Map (Map)
import qualified Data.Map.Strict as Map
{-|
---------------------------
| 1 | 2 ABC | 3 DEF |
___________________________
| 4 GHI | 5 JKL | 6 MNO |
@uskudnik
uskudnik / default.nix
Created June 23, 2017 18:43
example-python-nix-env.nix
let channels = rec {
pkgs = import <nixpkgs> {};
pkgs-unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) {};
};
in with channels;
let dependencies = rec {
_pip = pkgs.python36Packages.pip;
_virtualenv = pkgs.python36Packages.virtualenv;
_ipython = pkgs.python36Packages.ipython;
@uskudnik
uskudnik / nixos-on-dell-9560.org
Created June 17, 2017 23:29 — forked from grahamc/nixos-on-dell-9560.org
NixOS on a Dell 15" 9560 with the 4K screen.
@uskudnik
uskudnik / building-set-perf.py
Last active August 2, 2016 12:23
set([list of nubmers]) vs. {list of numbers}
## A _very_ naive comparison of set([list of numbers]) vs {list of numbers}
# set([list of numbers]) vs {list of numbers} results in ~25% performance improvements on simple lists for {list of numbers}:
====
> python -m timeit "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}"
1000000 loops, best of 3: 0.911 usec per loop
> python -m timeit "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}"
1000000 loops, best of 3: 0.901 usec per loop
> python -m timeit "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}"
1000000 loops, best of 3: 0.924 usec per loop