Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
bruh

Tyrell Keene tywkeene

💭
bruh
  • Contrast Security
  • United States
View GitHub Profile
@tywkeene
tywkeene / replace-snake-case.sh
Created Mar 9, 2020
Replace snake case in golang with go lint
View replace-snake-case.sh
#!/bin/bash
for file in $(find . -name "*.go" -type f); do
line=$(golint -set_exit_status ${file} 2>&1 | grep underscore | grep -Eo "[a-zA-Z_]+ should be.*" ) | uniq
old=$(echo $line | cut -d " " -f 1)
new=$(echo $line | cut -d " " -f 4)
echo "$old -> $new"
sed -e "s/${old}/${new}/g" $file
View flatten.go
package flatten
// FlattenArray flattens the array input, and places inputues into the array output
// When a nested array is encountered, FlattenArray will recurse into itself
//
// In the case that an element in input is not either int or []int, FlattenArray returns nil
func FlattenArray(input []interface{}) []int {
var output []int
for _, val := range input {
switch i := val.(type) {
@tywkeene
tywkeene / hello-world-strlen.s
Created Aug 30, 2019
Hello world loop with strlen subroutine
View hello-world-strlen.s
.text
.global _start
_start:
// Load registers with values
ldr r1, =message // Load message into r1
bl strlen // Call strlen
mov r7, #4 // Syscall write
mov r4, #10 // Loop counter
loop:
@tywkeene
tywkeene / crypto.sh
Last active Apr 27, 2020
Encrypt files and directories securely with pgp/tar/gzip/shred all in a small shell script
View crypto.sh
#!/usr/bin/env bash
set -e
function yesno() {
read -p "$1 Continue? (y/n): "
case $(echo -e "$REPLY" | tr '[A-Z]' '[a-z]') in
y|yes) echo "yes" ;;
*) echo "no" ;;
esac
View slaughter.sh
#!/bin/bash
#Ruthlessly slaughters a process by process name
function slaughter(){
kill -9 $(pgrep $1)
}
View keybase.md

Keybase proof

I hereby claim:

  • I am tywkeene on github.
  • I am tywkeene (https://keybase.io/tywkeene) on keybase.
  • I have a public key whose fingerprint is F665 D69D 51BD D628 0C87 145C 9B59 7B45 757B 8D52

To claim this, I am signing this object:

View blockchain.go
package main
import (
"bufio"
"crypto/sha512"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"os"
@tywkeene
tywkeene / gencert.sh
Created Apr 13, 2016 — forked from bradland/gencert.sh
Generate a self-signed SSL cert
View gencert.sh
#!/bin/bash
# Bash shell script for generating self-signed certs. Run this in a folder, as it
# generates a few files. Large portions of this script were taken from the
# following artcile:
#
# http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html
#
# Additional alterations by: Brad Landers
# Date: 2012-01-27
View Dockerfile.node
FROM ubuntu
MAINTAINER Tyrell Keene <tyrell.wkeene@gmail.com>
ADD http://get.influxdb.org/influxdb_0.9.0-rc28_amd64.deb influxdb_latest_amd64.deb
RUN dpkg -i influxdb_latest_amd64.deb
ADD ./config_node.toml /root/config.toml
ADD ./start.sh /start.sh
EXPOSE 8084 8086
@tywkeene
tywkeene / docker-nuke.rb
Last active Aug 29, 2015
A simple command line tool to nuke your docker
View docker-nuke.rb
#!/usr/bin/env ruby
require 'docker'
actions = {
"rmi" => lambda{|force|
Docker::Image.all.map{|img|
puts img.id[0..12]
img.remove(:force => force)}
},
"rm" => lambda{|force|