Skip to content

Instantly share code, notes, and snippets.

locals {
container_definitions = jsonencode([
{
name = var.name,
image = var.image,
cpu = var.cpu,
memory = var.memory,
portMappings = [
{
containerPort = var.port,
@lukaf
lukaf / main.rs
Last active August 5, 2024 02:28
rust: read from fifo
use std::fs::File;
use std::io::{BufRead, BufReader};
let f = File::open("/run/user/1000/bspwm_fifo.paahBQ").unwrap();
let mut b = String::new();
let mut reader = BufReader::new(f);
loop {
let data = reader.read_line(&mut b).unwrap();
if data != 0 {
@lukaf
lukaf / main.go
Created January 12, 2018 17:16
dynamo hammer
package main
import (
"flag"
"log"
"os"
"os/signal"
"sync"
"syscall"
"time"
@lukaf
lukaf / client
Last active August 4, 2016 11:15
Docker client: spawn many short lived containers
package main
import (
"flag"
"fmt"
"os"
"time"
"golang.org/x/net/context"
@lukaf
lukaf / configReload.go
Created November 12, 2015 21:03
go: configuration reload
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"os/signal"
"sync/atomic"
@lukaf
lukaf / gist:517ca3833cf4e07ebfaf
Last active August 29, 2015 14:24
All branches from org repos
def branchApi = new URL("https://api.github.com/repos/:org/:branch/branches")
def connection = branchApi.openConnection()
connection.setRequestProperty("Authorization", "token ******")
if (connection.responseCode == 200) {
def branches = new groovy.json.JsonSlurper().parseText(connection.content.text)
for (branch in branches) {
println(branch.name)
}
}
@lukaf
lukaf / gist:57d1904d929949afa609
Created May 7, 2015 13:07
SSLPoke - shamelessly stolen from https://gist.github.com/4ndrej/4547029 (but I'll always find it here)
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
### Keybase proof
I hereby claim:
* I am lukaf on github.
* I am lukaf (https://keybase.io/lukaf) on keybase.
* I have a public key whose fingerprint is AE6A D974 E804 35F2 6E10 FA1D BDE4 D237 82B9 09A9
To claim this, I am signing this object:
@lukaf
lukaf / ZipCompressDir.go
Last active August 29, 2015 14:17
Try to compress directory. Needs testing.
func CompressDir(directory string, filename string) error {
output, err := os.Create(filename)
if err != nil {
log.Printf("Unable to create destination file %s\n", filename, err)
return err
}
defer output.Close()
archive := zip.NewWriter(output)
defer archive.Close()
@lukaf
lukaf / output.txt
Last active August 29, 2015 14:14
Extremely simple type check decorator for Python - positional args only
from __future__ import print_function
class Types(object):
def __init__(self, *args):
self.dargs = args
def __call__(self, fun):
self.fun = fun