Skip to content

Instantly share code, notes, and snippets.

View netj's full-sized avatar

Jaeho Shin netj

View GitHub Profile
#!/usr/bin/env bash
# mosh-server wrapper for Kerberos/AFS home environment
#
# Author: Jaeho Shin <netj@cs.stanford.edu>
# Created: 2014-04-25
# Requires: readlink in GNU coreutils
set -eu
self=$(readlink -f "$0")
next=$(type -ap mosh-server | xargs -L1 readlink -f |
@joelkuiper
joelkuiper / gist:9eb52555e02edb653dcf
Last active March 22, 2021 12:58
highlight a pattern with PDFBox
The PDFTextAnnotator will accept a PDF and a pattern, it will highlight all occurances of that pattern in the document.
It inherits from the PDFTextStripper (so things like start end end page should still be configurable)
See the App file for a basic usage example
@joelkuiper
joelkuiper / TextHighlight
Last active October 21, 2020 07:25
A example class for adding highlights to PDFs based on a Pattern or String
/*
* Copyright 2014 Joël Kuiper
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#!/usr/bin/env bash
size=1024 # MB
mount_point=$HOME/tmp
name=$(basename "$mount_point")
usage() {
echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \
"(default: mount)" >&2
}
@kamermans
kamermans / docker_ephemeral_create.sh
Last active September 22, 2022 18:32
AWS EC2 script to mount Instance Store 0 and 1 as Docker temp and volume storage
#!/bin/sh -e
# This script will DESTROY /dev/xvdb and /dev/xvdc and remount them
# for Docker temp and volume storage.
# It is intended for EC2 instances with 2 ephemeral SSD instance stores
# like the c3.xlarge instance type.
service docker stop || true
# Setup Instance Store 0 for Docker Temp
# (set in /etc/default/docker)
@joshbode
joshbode / LICENSE.md
Last active April 5, 2024 14:52
YAML Loader with include constructor (Python 3)

MIT License

Copyright (c) 2018 Josh Bode

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@treyhunner
treyhunner / time_dict_merge.py
Last active November 3, 2023 08:13
Test performance of different dictionary merging functions in Python
"""
Results:
multiple_update: 33 ms
copy_and_update: 27 ms
dict_constructor: 29 ms
kwargs_hack: 33 ms
dict_comprehension: 33 ms
concatenate_items: 81 ms
union_items: 81 ms
@simont77
simont77 / elgato-eve.md
Last active January 27, 2024 13:31 — forked from gomfunkel/elgato-eve.md
Elgato Eve HomeKit Services & Characteristics

Elgato Eve HomeKit Services & Characteristics

A work in progress collection of proprietary and as of yet undocumented HomeKit characteristics and their UUIDs used by Elgato Eve.

Based on the work by gomfunkel and 0ff. Characteristics and data dump for Door, Motion and Thermo thanks to @NebzHB.

More infos not yet incorporated in the comment section.

This list is not including all Eve accessories available and some services and characteristics still make no sense to me. If you have anything to contribute, please leave a comment. There is no guarantee that the information listed below is correct.

@netj
netj / remocon
Last active May 21, 2018 01:10
MOVED TO: https://github.com/netj/remocon since 2018-05
#!/usr/bin/env bash
# remocon -- run given command remotely, replicating local git work tree on a remote host, and downloading remote changes if needed
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2018-03-08
##
set -euo pipefail
error() { echo >&2 "📡 ‼️ " "$@"; false; }
warning() { echo >&2 "📡 ⚠️ " "$@"; }
@netj
netj / exshell
Last active September 21, 2018 14:23
#!/usr/bin/env bash
# exshell -- a handy way to use command-line formulae's output to augment a TAB-separated input
#
# Synopsis:
# $ cat a.txt
# USA United States of America
# India Republic of India
# South_Korea Republic of Korea (ROK)
#
# $ exshell <a.txt \