Skip to content

Instantly share code, notes, and snippets.

View adisbladis's full-sized avatar
:shipit:
^ This guy

adisbladis

:shipit:
^ This guy
View GitHub Profile
@adisbladis
adisbladis / pkijs-decode-pem-node.js
Created May 10, 2018 03:04
Minimal example of loading a PEM certificate using pkijs (in nodejs)
#!/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')
use_nix() {
eval "$(lorri direnv)"
}
@adisbladis
adisbladis / iso.nix
Created January 3, 2020 17:46
Nixos custom iso
# env NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix --no-out-link --show-trace
{ config, lib, pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix>
];
boot.kernelPackages = pkgs.linuxPackages_latest;
@adisbladis
adisbladis / envrc.bash
Created May 7, 2018 05:20
Better python dev experience with direnv + nix + pipenv
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
@adisbladis
adisbladis / elemental_ircd_decloaker.c
Created August 10, 2017 14:47
An elemental ircd decloaker
/*
Made by Adam Hose <adis@blad.is>
Licensed under the GNU General Public License v2.0
Most code is straight up copied from elemental ircd
*/
#include <stdio.h>
#include <stdlib.h>
@adisbladis
adisbladis / table.org
Last active July 23, 2019 12:27
gemset.nix duplicates
PackageCount
multi_json-1rl0qy4inf1mp8mybfk56dfga0mvx97zwpmq5xmiwl5r770171nv19
thread_safe-0nmhcgq6cgz44srylra07bmaw99f5271l0dpsvl5f75m44l0gmwy17
mini_portile2-15zplpfw3knqifj9bpf604rb3wc1vhq6363pd6lvhayng8wql5vy15
addressable-0bcm2hchn897xjhqj9zzsxf3n9xhddymj4lsclz508f4vw3av46l14
concurrent-ruby-1x07r23s7836cpp5z9yrlbpljcxpax14yw4fy4bnp6crhr6x24an13
tzinfo-1fjx9j327xpkkdlxwmkl3a8wqj7i4l4jwlrv3z13mg95z9wl253z13
nokogiri-02bjydih0j515szfv9mls195cvpyidh6ixm7dwbl3s2sbaxxk5s413
{ pkgs, ...}:
let
scope = pkgs.newScope {
openssl = pkgs.openssl_1_1;
pkgs = pkgs // { openssl = pkgs.openssl_1_1; };
};
beam = pkgs.beam.override { callPackage = scope; };
in beam.interpreters.erlangR22
@adisbladis
adisbladis / duplicates.org
Created July 5, 2019 13:57
Find duplicate dependencies in buildGoModule packages in nixpkgs
PackageTimes duplicated
github.com/pmezard/go-difflib23
github.com/davecgh/go-spew21
golang.org/x/text20
github.com/stretchr/testify18
gopkg.in/yaml.v215
github.com/fsnotify/fsnotify12
github.com/inconshreveable/mousetrap12
github.com/pkg/errors12
{ stdenv, fetchFromGitHub, automake, zlib, libpng, libjpeg
, freetype, libX11, libXext, yacc, flex }:
stdenv.mkDerivation rec {
version = "unstable-2019-05-20";
pname = "microwindows";
src = fetchFromGitHub {
owner = "ghaerr";
repo = "microwindows";
@adisbladis
adisbladis / defer.py
Last active May 13, 2019 16:46
Go-style defer from python
#!/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: