Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@cicorias
cicorias / parse_dfsio.py
Created July 22, 2022 20:47
Parses output from Hadoop DFSIO utility
#!/usr/bin/env python3
def parse_file(file_name):
keys = list()
rows = list()
row = dict()
with open(file_name, 'r') as log:
items = [line.split(':', 1) for line in log]
for item in items:
@cicorias
cicorias / uuidv7.c
Created July 14, 2022 01:25 — forked from fabiolimace/uuidv7.c
UUID v7 for C
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/random.h>
#define UUID_T_LENGTH (16)
#define UNIX_TS_LENGTH (6)
@cicorias
cicorias / direnv-win.md
Created July 5, 2022 13:57 — forked from rmtuckerphx/direnv-win.md
Steps to install direnv on Windows

direnv on Windows

Overview

In JavaScript projects, I used to use dotenv so that I could put local environment variables in a .env file for local development. But dotenv requires you to add code to your project. With direnv, you can put local env vars in a .envrc file and those env vars are loaded automatically in the shell.

Steps to install

For these steps, it is assummed that you have installed Git Bash on Windows. I also use VSCode as my editor.

  1. Create a folder such as c:\tools to put the direnv.exe file and add it to the Windows PATH
@cicorias
cicorias / .bash_profile
Created May 6, 2022 18:35 — forked from gowravshekar/.bash_profile
Hive 2.3.3 with Hadoop 3.1.0 on Mac OS
export HADOOP_HOME=/Users/username/Tools/hadoop-3.1.0
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
alias hstart=$HADOOP_HOME/sbin/start-all.sh
alias hstop=$HADOOP_HOME/sbin/stop-all.sh
export HIVE_HOME=/Users/username/Tools/apache-hive-2.3.3-bin
export PATH=$PATH:$HIVE_HOME/bin
@cicorias
cicorias / loopit.sh
Last active April 2, 2022 20:14
utilities for printf vulnerability cs647
#!/usr/bin/env bash
for i in {1..220}; do
echo | ./vulnFileCopy2 "'%$i\$x..'"
printf "\nLast offset was: ${i}\n"
done
@cicorias
cicorias / README.md
Created March 23, 2022 13:16
Convert AVRO files to JSONL files using Python

Overview

Using this you can run against a directory that has nested files/folders with files of *.avro.

This will walk the tree, convert alongside each of the avro files.

python avroConvert.py "mypath"

Generate Jar with dependencies (fatJar) using Gradle

There are multiple posts (old and new) with instructions on how to generate a fat jar, this is, a jar file for your application containing also your application's dependencies. Most solutions I have tried did not work for me, even in a simple Hello World java application, but I have found one that seems to work as expected.

Here it is:

Instructions

@cicorias
cicorias / docker-for-mac.md
Created March 13, 2022 16:33 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@cicorias
cicorias / Makefile
Last active May 16, 2022 21:57
Caesar Cipher in Assembly
SOURCES=caesar.s
OBJECTS=caesar.o
PRODUCT=caesar
uname_m := $(shell uname -m)
$(info uname_m=$(uname_m))
# 32 bit
LDFLAGS.i686=
ASFLAGS.i686=
# 64 bit
@cicorias
cicorias / preRequest.js
Last active February 18, 2022 20:43
sending traceparent for opentelemetry in postman
const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');
//let traceparent = "00-" + genRanHex(32) + "-00" + genRanHex(14) + "-01"
let traceparent = "00-" + genRanHex(32) + "-" + genRanHex(16) + "-01"
pm.environment.set("traceparent", traceparent)
console.warn("sent " + traceparent)