This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_nix_build_defexpr () { | |
local -a result | |
local -a queue=($1) | |
setopt local_options null_glob | |
while [[ ${#queue} > 0 ]]; do | |
local current=$queue[1] | |
shift queue | |
if [[ -e $current/default.nix ]]; then | |
result+=($current) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with builtins; | |
let | |
# evaluate expr, returning default on error | |
tryDefault = expr: default: | |
let res = (tryEval expr); | |
in if res.success then res.value else default; | |
isPython = pkg: pkg?name && (parseDrvName pkg.name).name == "python"; | |
hasPropagatedPython = pkg: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function expectOne(array) { | |
if(array.length === 1) | |
return array[0]; | |
else | |
throw new Error("Expected one element, got " + array.length); | |
} | |
function findMediaTitle() { | |
var bag = expectOne(document.getElementsByClassName("playback-longpause-container")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Requires the following preamble: | |
preamle = r""" | |
\usepackage{rotating} %% rotated column labels | |
\usepackage{colortbl} %% Colored cells | |
\usepackage{hhline} %% Borders that play nice with colortbl | |
\definecolor{lightgray}{gray}{0.8} | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Only tested with spacemacs | |
(defvar my-current-focus-symbol nil) | |
(make-variable-buffer-local 'my-current-focus-symbol) | |
(defvar my-focus-symbol-face 'hi-yellow) | |
(defun mouse-set-point-and-hl-symbol (event) | |
(interactive "e") | |
(mouse-set-point event) | |
;; Evil workaround crap (without this every other click visual state is activated...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# | |
### Thinkpad x220 config | |
xinput disable "SynPS/2 Synaptics TouchPad" | |
# Doc: https://www.x.org/wiki/Development/Documentation/PointerAcceleration/ | |
TP="TPPS/2 IBM TrackPoint" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun nix-shell-c-system-header-paths () | |
"Extract header search paths from the NIX_CFLAGS_COMPILE env variable" | |
(cl-labels ((every-other (li &optional pick) | |
(when li | |
(if pick | |
(cons (car li) (every-other (cdr li))) | |
(every-other (cdr li) (not pick)))) | |
)) | |
(let* ((cflags (getenv "NIX_CFLAGS_COMPILE"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This is free and unencumbered software released into the public domain. | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# In jurisdictions that recognize copyright laws, the author or authors | |
# of this software dedicate any and all copyright interest in the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/usr/env bash | |
# Originaly from: https://www.reddit.com/r/NixOS/comments/5yxt45/simple_nix_package_search/ | |
nq () { | |
local CACHE="$HOME/.cache/nq-cache" | |
if ! ( [ -e $CACHE ] && [ $(stat -c %Y $CACHE) -gt $(( $(date +%s) - 3600*24*7 )) ] ); then | |
# read gotcha.. can't pipe to read (as usual zsh beats bash) | |
read x MEM_AVAIL_KB UNIT < <(grep MemAvailable: /proc/meminfo) | |
if [[ $UNIT != "kB" || $MEM_AVAIL_KB -lt 1000000 ]]; then | |
# nix-env can easily use up to 1GB during -qa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
function merge_repo_to_subdir { | |
local url=$1 | |
local commit=$2 | |
local module_path=$3 | |
if [[ -z $url || -z $commit || -z $module_path ]]; then | |
echo "Usage: merge-repo-to-subdir.sh URL BRANCH PATH" >&2 | |
exit 1 |
OlderNewer