Skip to content

Instantly share code, notes, and snippets.

View aespinosa's full-sized avatar

Allan Espinosa aespinosa

View GitHub Profile
@aespinosa
aespinosa / vagrant-plugin.rb
Created August 3, 2017 10:56
Some form of vagrant plugin to setup proxies
class Allan
def initialize(app, env)
@app = app
@machine = env[:machine]
end
def call(env)
@app.call env
setup_debian_apt if @machine.box.name =~ /bento\/debian/
setup_centos_yum if @machine.box.name =~ /centos\/7/
@aespinosa
aespinosa / vagrant-plugin.rb
Created August 3, 2017 10:56
Some form of vagrant plugin to setup proxies
class Allan
def initialize(app, env)
@app = app
@machine = env[:machine]
end
def call(env)
@app.call env
setup_debian_apt if @machine.box.name =~ /bento\/debian/
setup_centos_yum if @machine.box.name =~ /centos\/7/
@aespinosa
aespinosa / nix-push.pl
Created July 25, 2017 03:22
nix-push parent references only
#! /nix/store/jxs0zbsbvajw2kbf6j1pqvpsf3cijqbm-perl-5.24.1/bin/perl -w -I/nix/store/0m3cha88h649i7zf3q7qm2ky87y10wkw-nix-1.11.13/lib/perl5/site_perl/5.24.1/darwin-2level -I/nix/store/yj53jd5kl0ipq3ba3kj2m8spl0d7wl7w-perl-DBI-1.636/lib/perl5/site_perl -I/nix/store/c09ysri8dvrckn8pzh11vhyv3ikyr3b9-perl-DBD-SQLite-1.50/lib/perl5/site_perl -I/nix/store/yikv6vgrfc9602wpgq19njk1dphrylil-perl-WWW-Curl-4.17/lib/perl5/site_perl
use utf8;
use strict;
use File::Basename;
use File::Path qw(mkpath);
use File::stat;
use File::Copy;
use MIME::Base64;
use Nix::Config;
nix-store --realize /nix/store/fzp63riikr25vx2h367jwlri5ffaknhr-test-kitchen-1.16.0 --option extra-binary-caches http://proxy.dev:8081/repository/nixos-cache/ -vvvvv --option debug-subst 1
starting substituter program ‘/nix/store/crqd5wmrqipl4n1fcm5kkc1zg4sj80js-nix-1.11.11/libexec/nix/substituters/download-using-manifests.pl’
starting substituter program ‘/nix/store/crqd5wmrqipl4n1fcm5kkc1zg4sj80js-nix-1.11.11/libexec/nix/substituters/download-from-binary-cache.pl’
download-from-binary-cache.pl: expired 0 negative entries
download-from-binary-cache.pl: checking binary caches for info on /nix/store/fzp63riikr25vx2h367jwlri5ffaknhr-test-kitchen-1.16.0
don't know how to build these paths:
/nix/store/fzp63riikr25vx2h367jwlri5ffaknhr-test-kitchen-1.16.0
building ‘/nix/store/fzp63riikr25vx2h367jwlri5ffaknhr-test-kitchen-1.16.0’
| substitution of ‘/nix/store/fzp63riikr25vx2h367jwlri5ffaknhr-test-kitchen-1.16.0’: created
| substitution of ‘/nix/store/fzp63riikr25vx2h367jwlri5ffaknhr-test-kitchen-1.16.0’: woken
https://chefcommunity.slack.com/archives/C2VACTK2A/p1497900148839848
@aespinosa
aespinosa / upstream_test.rb
Last active April 16, 2017 06:42
kubernetes resource autogeneration spike
require 'chef/resource'
require 'kramdown'
require 'minitest/autorun'
DOC = DATA.read
class SomeResource < Chef::Resource
property :base_properties
def self.use_version(version)
if version == '1.6.1'
load_kube_16
@aespinosa
aespinosa / gist:4930a99ccb7362ebcdd940e24cd3f06b
Created January 17, 2017 04:12
image_science can't find references to libruby
irb> require 'image_science'
/tmp/ccLnaq6a.o: In function `raise_error':
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0xd): undefined reference to `rb_thread_current'
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0x18): undefined reference to `rb_thread_local_aref'
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0x2f): undefined reference to `rb_thread_current'
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0x3f): undefined reference to `rb_thread_local_aset'
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0x49): undefined reference to `rb_string_value_cstr'
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0x53): undefined reference to `rb_eRuntimeError'
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0x64): undefined reference to `rb_raise'
Inline_ImageScience_20a6c1167e26493622aab915959b49d1.c:(.text+0x6b): undefined reference to `rb_eRuntimeError'
@aespinosa
aespinosa / default.nix
Created October 31, 2016 15:24
NIX_CURRENT_LOAD=`pwd` NIX_REMOTE_SYSTEMS=`pwd`/remotes.conf NIX_BUILD_HOOK=$HOME/.nix-profile/libexec/nix/build-remote.pl nix-build --argstr system x86_64-linux
# To build on macOS
# NIX_CURRENT_LOAD=`pwd` NIX_REMOTE_SYSTEMS=`pwd`/remotes.conf \
# NIX_BUILD_HOOK=$HOME/.nix-profile/libexec/nix/build-remote.pl \
# nix-build --argstr system x86_64-linux
#
# remotes.conf
# vagrant@<ip> x86_64-linux $HOME/.vagrant.sh/insecure_private_key 1
{ system ? builtins.currentSystem }:
with import <nixpkgs> {
system = system;
@aespinosa
aespinosa / default.nix
Last active October 30, 2016 13:38
nix-store -q --tree /nix/store/c4xb0czlr9dy9j0nln9mxijylblr4vmj-cpu-app/bin/app
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "cpu-app";
enableSharedExecutables = false;
buildInputs = [
(haskellPackages.ghcWithPackages (p: [p.yesod ]))
];
@aespinosa
aespinosa / default.nix
Created October 30, 2016 13:18
ghc -O -static -threaded -optl-static app.hs
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "cpu-app";
enableSharedExecutables = false;
buildInputs = [
(haskellPackages.ghcWithPackages (p: [p.yesod ]))
];
}