Skip to content

Instantly share code, notes, and snippets.

View tkellen's full-sized avatar
👽
out there

Tyler Kellen tkellen

👽
out there
View GitHub Profile
@tkellen
tkellen / main.go
Last active April 30, 2024 13:53
fetch secret test oci
package main
import (
"context"
"encoding/base64"
"log"
"os"
"time"
"github.com/oracle/oci-go-sdk/v65/common"
@tkellen
tkellen / main.go
Created April 30, 2024 12:35
fetch secret from oci vault
package main
import (
"context"
"encoding/base64"
"log"
"os"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/secrets"
@tkellen
tkellen / explode-manifest.sh
Created April 16, 2020 13:31
split up monolithic k8s yaml file
#!/usr/bin/env bash
# split a monolithic k8s manifest file into separate files.
set -euo pipefail
REMOVE_KEYS="chart:|release:|heritage:"
function usage {
cat <<EOF
Usage: $(basename "$0") [output_dir] < input.yml
Explode a monolithic k8s manifest file into separate files during vendoring.
@tkellen
tkellen / gist:2003309
Created March 8, 2012 20:41
determining number of weeks between date range in postgres
-- First attempt:
EXPLAIN ANALYZE SELECT count(DISTINCT date_trunc('week',s)) FROM generate_series('1900-01-01'::date,CURRENT_DATE,interval '1 day') AS s;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=12.51..12.53 rows=1 width=8) (actual time=72.552..72.553 rows=1 loops=1)
-> Function Scan on generate_series s (cost=0.01..10.01 rows=1000 width=8) (actual time=24.495..27.619 rows=40975 loops=1)
Total runtime: 73.005 ms
(3 rows)
SELECT count(DISTINCT date_trunc('week',s)) FROM generate_series('1900-01-01'::date,CURRENT_DATE,interval '1 day') AS s;
@tkellen
tkellen / gist:5116460
Created March 8, 2013 13:33
Remove a PDF Password w/ Ghost Script
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=frame-nopass.pdf -c .setpdfwrite -f frame.pdf
@tkellen
tkellen / Vagrantfile
Last active March 11, 2016 21:36
learn-deployment
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/trusty64'
config.vm.network :private_network, ip: '10.10.0.10'
end
@tkellen
tkellen / all.yml
Created January 31, 2016 15:55
ansible bastion host configuration via extra-vars
host_key_checking: true
host_key_checking_option: "{{ (host_key_checking == true) | ternary('','-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no') }}"
bastion_host: false
bastion_user: "{{ lookup('env', 'USER') }}"
bastion_ssh_arg: -o ProxyCommand='ssh {{host_key_checking_option}} -W %h:%p -q {{bastion_user}}@{{bastion_host}}' {{host_key_checking_option}}
ansible_ssh_extra_args: "{{ bastion_host | ternary(bastion_ssh_arg, '') }}"
@tkellen
tkellen / pr.py
Created December 19, 2015 21:05
simple dynamic inventory file for hookshot / ansible integration
#!/usr/bin/env python
import sys
import os
try:
import json
except ImportError:
import simplejson as json
@tkellen
tkellen / Tyler.prg
Created October 13, 2015 12:55
My first program
** Tyler's A.K.A. Hobbes First Program
** File Name: Tyler.Prg
SET STATUS OFF
SET SCOREBOARD OFF
SET TALK OFF
** Section To name memory variables
name=space(25)
male=.t.
@tkellen
tkellen / gist:2888811
Created June 7, 2012 13:28
function pointer in c
// this code will run mode_one once, then mode_two forever.
#include <stdio.h>
// a pointer to the mode you want to call
void (*modePtr)();
// function prototypes
void mode_one();
void mode_two();