This file contains hidden or 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
use nix |
This file contains hidden or 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 (import <nixpkgs> {}); | |
let | |
# Extract license from a Linux box | |
# It's in ~/Android/Sdk/licenses/android-sdk-license | |
sdkLicense = "d56f5187479451eabf01fb78af6dfcb131a6481e"; | |
in pkgs.mkShell { | |
buildInputs = with pkgs; [ |
This file contains hidden or 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 python | |
# The MIT License | |
# Copyright (c) 2018 Adam Hose (adisbladis) | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains hidden or 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
import contextlib | |
import functools | |
import paramiko | |
import select | |
import sys | |
import os | |
if __name__ == '__main__': |
This file contains hidden or 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
use_nix() { | |
local shell_file=$(test -f shell.nix && echo shell.nix || echo default.nix) | |
local cache_key=$(nix-instantiate "$shell_file" 2> /dev/null | shasum -a 1 | cut -d ' ' -f 1) | |
# Use ram as virtualenv storage | |
local tmpdir | |
case $(uname -s) in | |
Linux*) tmpdir=$XDG_RUNTIME_DIR;; | |
Darwin*) tmpdir_SDK=$TMPDIR;; | |
*) tmpdir=/tmp |
This file contains hidden or 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 node | |
// Minimal example of loading a PEM certificate using pkijs (in node) | |
// babel-polyfill needs to be loaded for pkijs | |
// It uses webcrypto which needs browser shims | |
require('babel-polyfill') | |
const Pkijs = require('pkijs') | |
const Asn1js = require('asn1js') | |
const FS = require('fs') |
This file contains hidden or 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
use nix | |
layout_nix_pipenv() { | |
if [[ ! -f Pipfile ]]; then | |
log_error 'No Pipfile found. Use `pipenv` to create a Pipfile first.' | |
exit 2 | |
fi | |
# Use ram as virtualenv storage |
This file contains hidden or 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 node | |
const ChildProcess = require('child_process') | |
function findChildren(pid) { | |
const pgrep = ChildProcess.spawnSync('pgrep', ['-P', pid]) | |
// Probably segfault.. | |
// Happens on linux at least when there is no child | |
if(pgrep.status === null) { |
This file contains hidden or 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
In this moment of year NixPkgs already close to half of the umber of commits from previous year. | |
commits=12747/26374=0.483 | |
velocity_last_year=26374/365=72.258 commits/day | |
velocity_this_time=12747/109=116.945 commits/day | |
velocity_times=velocity_this_year/velocity_last_year=1.618 times | |
accel=(velocity_this_time-velocity_last_year)/current_day=0.410 commits/day^2 | |
velocity_end_of_year_extrapolated=velocity_last_year+365*accel=221.899 commits/day |
This file contains hidden or 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
# Teclast X98 Pro nixos install iso | |
# nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix --no-out-link --show-trace | |
{ config, lib, pkgs, modulesPath, ... }: | |
{ | |
imports = [ | |
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix> | |
]; | |
# Hardware is only well-supported on very recent kernels |