Skip to content

Instantly share code, notes, and snippets.

@manveru
manveru / point.cr
Created November 17, 2019 21:10
point type for avram
record Point, x : Float64, y : Float64
struct Point
def self.adapter
Lucky
end
module Lucky
alias ColumnType = Point
include Avram::Type
#!/usr/bin/env ruby
require 'net/http'
require 'json'
def make_query_inner(max_depth = 3, depth = 0)
return [] if depth >= max_depth
indent = ' ' * (6 + (depth * 2))
["\n#{indent}",
@manveru
manveru / default.nix
Created September 18, 2019 08:54
buildkite-agent-metrics
with import (
fetchTarball {
url = https://github.com/nixos/nixpkgs-channels/archive/c4196cca9acd1c51f62baf10fcbe34373e330bb3.tar.gz;
sha256 = "0jsisiw8yckq96r5rgdmkrl3a7y9vg9ivpw12h11m8w6rxsfn5m5";
}
) { overlays = [ (super: self: { go = super.go_1_12; }) ]; };
buildGoPackage rec {
pname = "buildkite-agent-metrics";
version = "5.1.0";
# Generated by crate2nix 0.5.1 with the command:
# "generate" "-o" "Cargo.nix"
# See https://github.com/kolloch/crate2nix for more info.
{ pkgs? import <nixpkgs> { config = {}; },
lib? pkgs.lib,
callPackage? pkgs.callPackage,
stdenv? pkgs.stdenv,
buildRustCrate? pkgs.buildRustCrate,
fetchurl? pkgs.fetchurl,
@manveru
manveru / make-bundler-app.rb
Last active May 6, 2019 07:22
Create bundlerApp drvs with ease.
#! /usr/bin/env nix-shell
#! nix-shell -i ruby -p ruby bundix bundler
require 'optparse'
require 'rubygems/package'
require 'rubygems/remote_fetcher'
require 'erb'
op = OptionParser.new do |o|
o.banner = "Usage: make-bundler-app.rb GEM_NAME [options]"
@manveru
manveru / hcloud_nixos.go
Created September 19, 2018 07:59
third try is a charm
package main
import (
"context"
"flag"
"fmt"
"io"
"log"
"net"
"os"
@manveru
manveru / hcloud_stage_1.sh
Created September 18, 2018 16:01
second approach for terraform&nixos&hcloud
#!/usr/bin/env bash
set -ex
apt-get install -y squashfs-tools git
rm -rf nixos-in-place
if [ ! -d nixos-in-place ]; then
git clone https://github.com/manveru/nixos-in-place.git
fi
cd nixos-in-place
@manveru
manveru / deploy.cr
Created September 14, 2018 10:36
Simple nixos-rebuild deployments
require "file_utils"
class Ops
property hosts : Array(String)
def initialize(host : String)
@hosts = [host]
end
HOSTS = Dir["box_*.nix"].map { |h| h[/^box_(.*)\.nix$/, 1] }
{ buildStatic ? false }:
with import <nixpkgs> {};
let
crystalLib = (import ./nix/crystal2nix.nix {
inherit stdenv lib remarshal runCommand;
}).crystalLib;
staticStdenv = (makeStaticLibraries stdenv);
in mkShell {
buildInputs = [
postgresql100
exact-dependencies = import ../elm-stuff/exact-dependencies.nix;
elmStuffPackages = lib.mapAttrs (name: info:
{
drv = stdenv.mkDerivation {
name = lib.replaceChars ["/"] ["-"] name + "-${info.version}";
src = fetchurl {
inherit (info) sha256 url;
};
phases = [ "unpackPhase" "installPhase" ];