Skip to content

Instantly share code, notes, and snippets.

$echo "use nix -p 'python3.withPackages(ps: [ps.ipython ps.click])'" > .envrc
direnv: loading .envrc
direnv: using nix -p python3.withPackages(ps: [ps.ipython ps.click])
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +WINDRES +_PATH +buildCommandPath +buildInputs +builder +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +name +nativeBuildInputs +out +outputs +passAsFile +propagatedBuildInputs +propagatedNativeBuildInputs +shell +stdenv +str
@sveitser
sveitser / cart.cljs
Created August 26, 2018 14:44
cljs shopping cart example
(ns cart.main
(:require [reagent.core :as reagent]
[re-frame.core :as rf]
[clojure.string :as str]))
;; -- Domino 1 - Event Dispatch -----------------------------------------------
(defn dispatch-add-to-cart
[item]
(rf/dispatch [:add-to-cart item]))
# To later refer to the path of the tarball in the nix store.
# Is there a better way?
{ src ? builtins.fetchTarball {
url = "https://releases.nixos.org/nixpkgs/nixpkgs-18.09pre148461.bf1b50cbc8f/nixexprs.tar.xz";
sha256 = "1kp55q3bp7lrs7qjpyp4mfngw89jrf7rbqhrrz9zwg27rz481gfa";
} }:
with import ( src ) { };
let phonemizer = pythonPackages.buildPythonPackage rec {
@sveitser
sveitser / clean_emails.js
Last active August 4, 2018 08:34
Google app script to remove old forum messages. Paste into https://script.google.com and schedule or whatever.
function cleanUp() {
// I think this refers to the date when the thread was started.
var delayDays = 90;
var max = 200;
var offset = 0;
var query = 'category:forums older_than:' + delayDays + 'd'
while (true) {
@sveitser
sveitser / config.el
Last active August 1, 2018 10:16
~/.emacs.d/modules/private/direnv/
(direnv-mode)
@sveitser
sveitser / init.el
Last active August 1, 2018 10:15
~/.doom.d/init.el
;;; init.el -*- lexical-binding: t; -*-
;; Copy me to ~/.doom.d/init.el or ~/.config/doom/init.el, then edit me!
(setq doom-font (font-spec :family "Iosevka" :size 16))
(doom! :feature
;debugger ; FIXME stepping through code, to help you add bugs
eval ; run code, run (also, repls)
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
#!/usr/bin/env bash
set -e
url=$(curl https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz -s -L -I -o /dev/null -w '%{url_effective}')
echo Got tarball URL "$url"
sha=$(nix-prefetch-url --unpack "$url")
echo With SHA $sha
cat > shell.nix <<EOF
@sveitser
sveitser / Entropy.ipynb
Last active September 7, 2018 08:00
Was wondering about entropy of pass phrases.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sveitser
sveitser / build.sh
Last active June 6, 2018 02:12
Build nix docker images
#!/usr/bin/env bash
#
# To build docker.nix.
# Nice way of building small docker images but currently does not
# have the correct environment to make nix-shell etc. usable.
#
# TODO:
# - Environment.
# - Versioning.
# - Hash of derivations should not change for the same inputs.
Config {
-- appearance
font = "xft:Fira Code:size=8:bold:antialias=true"
, bgColor = "#FDF6E3"
, fgColor = "#073642"
, position = Top
, border = BottomB
, borderColor = "#646464"
, textOffset = 11