Skip to content

Instantly share code, notes, and snippets.

@glallen01
glallen01 / protobuf_spark_schema_convertor.py
Created June 12, 2024 22:01 — forked from ragoragino/protobuf_spark_schema_convertor.py
Protobuf schema to Spark schema conversion
import google.protobuf.descriptor
from pyspark.sql.types import (
StructType,
StructField,
StringType,
IntegerType,
LongType,
DoubleType,
FloatType,
@glallen01
glallen01 / gla-chrome-tabs-to-org.el
Last active October 28, 2022 00:31
get tab urls from chrome into org-mode with applescript
(defun gla/chrome-tabs-to-org ()
(interactive)
;; adopted from applescript found here: https://pastebin.com/AXDtWJKL
(let* ((osascript-urls (do-applescript "
tell application \"Google Chrome\"
set allUrls to {}
repeat with theWindow in every window
set urlsInWindow to {}
repeat with theTab in every tab of theWindow
set currentUrl to the theTab\'s URL
event manager applet DEFAULT_VLAN_2
event syslog pattern "NATIVE_VLAN_MISMATCH:" period 180
action 10 regexp "with\s([A-Za-z0-9-]*).*\s(.*E.*[0-9].*)\s\(([0-9]*)\)" "$_syslog_msg" _matchA _FarHost _FarInt _FarVlan
action 20 regexp "on\s(.*E.*[0-9].*)\s\(([0-9]*)\),\swith" "$_syslog_msg" _matchB _NearInt _NearVlan
action 30 syslog msg "Fixing Trunk on $_NearInt to match $_FarInt vlan $_FarVlan native vlan on $_FarHost"
action 40 cli command "enable"
action 50 cli command "conf t"
action 60 cli command "int $_NearInt"
action 80 if $_FarVlan eq "2"
action 82 cli command " description TRUNK: $_FarHost $_FarInt"
@glallen01
glallen01 / eg-graphviz-libsixel-iterm.sh
Last active September 11, 2024 12:14
graphviz -> iterm
# from https://twitter.com/thingskatedid/status/1483847024894099458?s=20&t=7HJKiUFH7ucFOZSlCkMflQ
# transparent doesn't seem tow work with sixel
# convert -trim -bordercolor black -border 20 -transparent black -resize '80%' - - \
brew install libsixel
alias idot='dot -Tpng \
-Efontsize=18 -Efontname=sans -Ecolor=white -Efontcolor=white \
-Efontsize=18 -Nfontname=sans -Ncolor=white -Nfontcolor=white \
@glallen01
glallen01 / ansi_fn.sh
Created October 23, 2019 10:06
shell ansi functions
# from http://shallowsky.com/blog/linux/html-mail-in-mutt.html
echo -e "\e[1mbold\e[0m"
echo -e "\e[3mitalic\e[0m"
echo -e "\e[4munderline\e[0m"
echo -e "\e[9mstrikethrough\e[0m"
echo -e "\e[31mHello World\e[0m"
echo -e "\x1B[31mHello World\e[0m"
ansi() { echo -e "\e[${1}m${*:2}\e[0m"; }
bold() { ansi 1 "$@"; }
@glallen01
glallen01 / delete_by_query.sh
Last active September 4, 2019 11:35
delete by query test
# docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.3.1
strings_to_delete=(
"pktdatEnc="
"Interface statistics report"
"crying"
)
IFS=$'\n' # dont' break strings_to_delete on words, only newlines (default IFS=$' \t\n')
# TODO - wrap into one query
@glallen01
glallen01 / docupdatetest.org
Last active September 4, 2019 01:32
doc update
(emacs-version)
GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.5.0, Carbon Version 158 AppKit 1671.4)
 of 2019-08-29
GET /
@glallen01
glallen01 / .zshrc
Created January 2, 2019 12:35
Zsh rc
# Path to your oh-my-zsh installation.
export ZSH=/Users/gla/.oh-my-zsh
# See /usr/local/texlive/2018/index.html for links to documentation.
# The TeX Live web site (http://tug.org/texlive/) contains any updates and
# corrections. TeX Live is a joint project of the TeX user groups around the
# world; please consider supporting it by joining the group best for you. The
# list of groups is available on the web at http://tug.org/usergroups.html.
#
#
@glallen01
glallen01 / gist:b48cfa2c929efa905553309215f68e9d
Last active December 22, 2018 22:35
zsh to fetch a remote fork as a a branch
# todo, this substitution only works with zsh, and passing shell functions doesn't seem to work with parallel
# usage gfr https://github.com/user/fork.git
gfr() { git remote add ${${1%/*}##*/} $1; git fetch ${${1%/*}##*/} master:${${1%/*}##*/}; }
export -f gfr
function curl -v -H "Authorization: token ${GITHUBAPIKEY}" https://api.github.com/repos/${GITUSER}/${GITREPO}/forks |
jq '.[].clone_url' |
sed "s/\"//g" |
parallel -j 1 ./gfr :::