Skip to content

Instantly share code, notes, and snippets.

@radekg
radekg / Certificates.go
Created March 24, 2021 23:47 — forked from Mattemagikern/Certificates.go
Create x509 certificate chain using Golang. Root CA, Designated CA, server CA
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
@radekg
radekg / cloud.cfg
Created March 21, 2021 02:37 — forked from imduffy15/cloud.cfg
Cloud-init config example for using the none data source provider to setup a box for usage with vagrant on finding no cloud metadata service.
disable_ec2_metadata: True
datasource_list: [ "ConfigDrive", "None"]
datasource:
None:
userdata_raw: |
#!/bin/bash
groupadd vagrant
useradd -d /home/vagrant -s /bin/bash -m -g vagrant -G wheel vagrant
echo "root:vagrant" | chpasswd
@radekg
radekg / lru.go
Last active April 11, 2021 23:09
Simple LRU
package main
import (
"fmt"
"sync"
)
type item struct {
next *item
previous *item
@radekg
radekg / notes.md
Last active March 12, 2018 11:39
Kubernetes notes

calico: hostname must be all lowercase

Calico requires the node name to be lowercase. Maybe that's obvious knolwedge but all other components have no problems handling uppercase characters. Error:

[root@k8s-kube-w-8djLQqtkAHJZvaOa centos]# docker ps -a
CONTAINER ID        IMAGE                                      COMMAND             CREATED              STATUS                     PORTS               NAMES
327fa0492135        quay.io/calico/node                        "start_runit"       3 seconds ago        Exited (1) 2 seconds ago                       k8s_calico-node_calico-node-k257k_kube-system_24149352-2567-11e8-94a0-02c64064058a_3
994fe7650e97        quay.io/calico/cni                         "/install-cni.sh"   41 seconds ago       Up 40 seconds                                  k8s_install-cni_calico-node-k257k_kube-system_24149352-2567-11e8-94a0-02c64064058a_0

94122e279a5a gcr.io/google_containers/pause-amd64:3.0 "/pause" About a minute ago Up About a

@radekg
radekg / gist:91a8468fc6b26de7420b243b617e55af
Created December 17, 2016 12:15
A gem from Hacker News
Source: https://news.ycombinator.com/item?id=13198567
Always, always, always generate your own SSH moduli.
reply
notyourwork 4 hours ago [-]
For those uninformed you should expand on this to. It is a great suggestion but a statement like this to a uninformed isn't very helpful.
reply
@radekg
radekg / AsyncUtil.java
Last active April 13, 2017 21:25
Java AsyncUtil.eventually(...) tests
package com.gruchalski.testing;
import java.util.UUID;
import java.util.concurrent.*;
import static org.testng.Assert.fail;
public class AsyncUtil {
protected AsyncUtil() {}
@radekg
radekg / .spacemacs
Last active August 16, 2016 22:12
Emacs for lispy stuff
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@radekg
radekg / optparse.sh
Last active November 1, 2015 17:25
Poor man's option parser in bash
#!/bin/bash
function opt_parse() {
local _idx=1
local _last=""
while [ $_idx -lt $# ] || [ $_idx -eq $# ]; do
_v=${!_idx}
if [[ $_v == --* ]]; then
local _name=$(echo $_v | tr - _)
eval "__program_argument${_name}=::is-arg-set"
@radekg
radekg / my_app.sh
Last active August 29, 2015 14:24 — forked from guillermo/my_app.sh
#!/bin/bash
# This is a unix wrapper around the erlang vm. It provides the following functionality:
#
# * Spawns in foreground
# * Handle SIGHUP and call RELOADFUNC
# * Handle SIGTERM SIGQUIT and SIGINT telling to the vm to quit
# * Dies if the vm dies (for example kernel killing because out of memory)
#
# Forks and improvements are welcome.
@radekg
radekg / instructions.md
Last active August 29, 2015 14:21
Raspberry Pi - Erlang

Preparing SD card.

Find Raspberry Pi on the network:

brew install nmap
sudo nmap -v -sn 10.128.30.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'

where 10.128.30.0 is the network the thing is on.

Expand the filesystem with raspi-config.