Skip to content

Instantly share code, notes, and snippets.

View JacobJohansen's full-sized avatar

Jacob Johansen JacobJohansen

View GitHub Profile
@JacobJohansen
JacobJohansen / apple-keychain-pass-import.md
Created December 11, 2020 15:16 — forked from santigz/apple-keychain-pass-import.md
Import Apple Keychain into pass

Import Apple Keychain into pass

This guide shows how to import into pass your passwords stored in Apple's Keychain Access.

Find your keychain file

The default kaychain file is ~/Library/Keychains/login.keychain.

Passwords under the "Local Items" keychain (the default since Mavericks to sync with iCloud) use a different file format and can not be exported via the Apple's security tool we use. If that is you case, create a new keychain and drag-and-drop the keys. Your new keychain should have the .keychain extension.

-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEX9FnZBYJKwYBBAHaRw8BAQdAtPW3v52nqKbm4BCWGS4GKvQAui/uzqkU3QHB
a2+ndF60KUphY29iIE0gSm9oYW5zZW4gPGpvaGFuc2VuanV3cEBnbWFpbC5jb20+
iJAEExYKADgWIQQSHFwWzzJTY96gvZHOJHCadP8uLQUCX9FnZAIbAwULCQgHAwUV
CgkICwUWAgMBAAIeAQIXgAAKCRDOJHCadP8uLWdPAQDTXFF6bATOJt+4EDFdFgqs
JQjmFqJrtf0Kb7wpx1ZkUgEAz9zihvuy+yI0//VMjF2D9BgAy48X8LgEmgQXOZgT
+g+4MwRf0WdkFgkrBgEEAdpHDwEBB0Dz2HctW9qw/LkZZxg/jNUIEj5jiPUTC7kv
EQqN2yuE+Yh4BBgWCgAgFiEEEhxcFs8yU2PeoL2RziRwmnT/Li0FAl/RZ2QCGyAA
CgkQziRwmnT/Li3U0QD/dQM1nBVrcj1M91pir41bs2BeGKrOVx9SOr8NEU88S24A
@JacobJohansen
JacobJohansen / merge-maps.kt
Created November 5, 2020 05:03 — forked from cy6erGn0m/merge-maps.kt
Merge two maps with custom reduce function for Kotlin
private fun <K, V> Map<K, V>.mergeReduce(other: Map<K, V>, reduce: (V, V) -> V = { a, b -> b }): Map<K, V> {
val result = LinkedHashMap<K, V>(this.size() + other.size())
result.putAll(this)
other.forEach { e ->
val existing = result[e.key]
if (existing == null) {
result[e.key] = e.value
}
else {
@JacobJohansen
JacobJohansen / jvm-memory.md
Created September 2, 2020 20:47
interseting jvm settings

-XX:+UseContainerSupport -XX:MaxRAMPercentage=90 -XX:MinRAMPercentage=90

@JacobJohansen
JacobJohansen / cleanfiles.ps
Created July 13, 2020 15:43
get a list of file names only from directory and all subdirectories
. {(cmd /c "dir /o:n /b /s")} | out-string -stream | Select-String -Pattern ".*\..*" | out-string -stream | %{ $_.Split('\')[-1] } > cleanedFilename.csv

Keybase proof

I hereby claim:

  • I am jacobjohansen on github.
  • I am johansenj (https://keybase.io/johansenj) on keybase.
  • I have a public key ASB_xkm6FdE1GuRJPpoy1mtgdS6m--JuLiySNeCs3hIQnwo

To claim this, I am signing this object:

BEGIN MESSAGE.
2EuI4oSc4adzTjk 9O7QMfBoliMJQXt LtYzzKr6XOFUkyE LdEgnTuj1CTTZSo
9fmanIW63ZCQHY5 BBo9e6gUHQATCKq 6Xr2MZHgg6S0Th0 c8rfMkbxyXeJ07W
YvSSev3VoD8CNL8 II05Z9CfiIEWXq4 KkoNtOdslFUEi18 YZnxUlpRYDzYdbe
DxqHZIu9N4EIqBI AMz2I8vYo2BYkge vaH7y8sSTVh227E D.
END MESSAGE.
@JacobJohansen
JacobJohansen / delta-lake-pyspark-presto.py
Created July 1, 2020 20:33
deltalake create presto / athena queryable table, table schema generated for deltalake table dataframe
%spark.pyspark
def fieldPair(field): return "{} {}".format(field.name, field.dataType.typeName())
sc.addPyFile("/home/hadoop/extrajars/delta-core_2.12-0.6.1.jar")
from delta.tables import *
delta_dim_path = "s3://delta_dim_path"
df_dim.write.format("delta").save(delta_dim_path)
@JacobJohansen
JacobJohansen / configuration.json
Last active June 30, 2020 16:07
EMR configuration that supports zeppelin, presto, hue, spark, and hive configured to access AWS Glue. Zeppelin is also configured to used an s3 bucket as a notebook store
[
{
"Classification":"spark-hive-site",
"Properties":{
"hive.metastore.client.factory.class":"com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory",
"hive.metastore.schema.verification": "false"
}
},
{
"Classification":"hive-site",
@JacobJohansen
JacobJohansen / ca_and_cert_golang_demo.go
Created January 3, 2020 16:28 — forked from shaneutt/LICENSE
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
package main
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"