Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
deploying awesomeness

Jaka Hudoklin offlinehacker

🤓
deploying awesomeness
View GitHub Profile
@offlinehacker
offlinehacker / utils.nix
Created Oct 12, 2019
Reusable utility nix functions
View utils.nix
{
removeAttrByPath = attrPath: attrs:
let
recurse = residualPath: currentPath: set:
let
# if on course continue recursion else just return value
g = name: value:
if name == lib.head residualPath
then recurse (lib.tail residualPath) (currentPath ++ [name]) value
else value;
View libvirt-deploy.sh
#!/bin/bash
set -e
VIRSH=virsh
LIBVIRT_HOST=root@192.168.122.1
LIBVIRT_URI=qemu+ssh://$LIBVIRT_HOST/system
POOL=images
PROJECT=$1
SHARE_DIR=/storage/share
@offlinehacker
offlinehacker / certs.nix
Last active Feb 7, 2018
Kubernetes nixops deployment
View certs.nix
{
pkgs ? import <nixpkgs> {},
internalDomain ? "cluster.local",
externalDomain ? "<domain_name>",
serviceClusterIp ? "10.0.0.1"
}:
let
runWithCFSSL = name: cmd:
builtins.fromJSON (builtins.readFile (
pkgs.runCommand "${name}-cfss.json" {
View darwin.nix
import ./default.nix # The root nixpkgs default.nix
{
crossSystem = {
# That's the triplet they use in the mingw-w64 docs,
# and it's relevant for nixpkgs conditions.
config = "x86_64-w64-mingw32";
arch = "x86"; # Irrelevant
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {};
openssl.system = "mingw64";
View Dockerfile
FROM resin/armv7hf-debian-qemu
RUN [ "cross-build-start" ]
RUN apt-get update
RUN apt-get install -y python python-pip
RUN pip install virtualenv
RUN [ "cross-build-end" ]
View publish.js
'use strict';
const amqp = require('amqplib-easy')('amqp://localhost');
const exchangeOptions = {
exchange: 'amq.headers',
exchangeType: 'headers'
};
// takes a default connection for handling errors
@offlinehacker
offlinehacker / config.nix
Last active May 3, 2017
.nixpkgs/config.nix
View config.nix
# This is mostly a work in progress and might not work with what is in
# nixpkgs trunk. If you have questions, feel free to contact me:
# Jaka Hudoklin <jakahudoklin@gmail.com>
{
allowUnfree = true; # for flash and such
#allowBroken = true; # for testing
chromium.enableGoogleTalkPlugin = true;
chromium.enablePepperFlash = true;
View typableValidator.js
// npm install hapijs/joi#issue-577
'use strict';
var Joi = require('joi');
class TypableObject extends Object {
constructor(value, type) {
super(value);
Object.defineProperty(this, '_type', {value: type});
View init.coffee
# initialization file (not found)
View vimrc
" VAM {{{
" Set leader keys
let mapleader=","
let maplocalleader = ","
" put this line first in ~/.vimrc
set nocompatible | filetype indent plugin on | syn on
fun! SetupVAM()