Skip to content

Instantly share code, notes, and snippets.

View rockwotj's full-sized avatar
:shipit:

Tyler Rockwood rockwotj

:shipit:
View GitHub Profile
@fundter
fundter / automatic-to-explicit-module.sh
Created February 1, 2019 22:47
Turn a non-modular jar into a modular jar (Java module)
# Generate module-info.java
jdeps --generate-module-info <output-path-for-module-info.java> <path-to-non-modular-jar>
# Compile the module-info.java
javac --patch-module <name-of-the-module>=<path-to-non-modular-jar> <path-to-module-info.java>
# Update jar with module-info
cd <directory-containing-module-info.class> # avoid path prefix to module-info for next command
jar uf <path-to-non-modular-jar> module-info.class
@DGrady
DGrady / subprocess_filter.py
Last active December 7, 2022 01:09
Stream data asynchronously through a subprocess in Python
"""
Problem: provide two-way communication with a subprocess in Python.
See also:
- https://kevinmccarthy.org/2016/07/25/streaming-subprocess-stdin-and-stdout-with-asyncio-in-python/
- http://eli.thegreenplace.net/2017/interacting-with-a-long-running-child-process-in-python/
"""
import asyncio
import sys
@understeer
understeer / latency.txt
Created January 12, 2017 14:04 — forked from eshelman/latency.txt
HPC-oriented Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference/hit 1.5 ns 4 cycles
Floating-point add/mult/FMA operation 1.5 ns 4 cycles
L2 cache reference/hit 5 ns 12 ~ 17 cycles
Branch mispredict 6 ns 15 ~ 20 cycles
L3 cache hit (unshared cache line) 16 ns 42 cycles
L3 cache hit (shared line in another core) 25 ns 65 cycles
Mutex lock/unlock 25 ns
L3 cache hit (modified in another core) 29 ns 75 cycles
@asciimike
asciimike / BUILD
Last active July 11, 2022 13:28
Example of how to reference a CocoaPod in Bazel
ios_app(
name = "App",
hdrs = ["src/*.h"],
srcs = ["src/*.m"],
deps = [
"@SDWebImage//:latest_library",
],
)
ios_test(
@clarkli86
clarkli86 / ldd_awk.sh
Created March 16, 2016 02:10
Copy all shared libraries for a binary to directory
ldd file | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /destination
@raelg
raelg / gist:e12d731ba01ba58f0006
Created January 20, 2015 16:44
Scala Gson Serializer
package services
import java.lang.reflect.Type
import com.google.gson._
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{DateTime, DateTimeZone}
object Serializers {
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@devunwired
devunwired / GifDecoder.java
Last active January 26, 2024 21:14
An optimized implementation of GifDecoder for Android devices.
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* 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:
@jjarmoc
jjarmoc / gist:1571540
Created January 6, 2012 17:21
Quoted Printable encode/decode bash aliases - suitable for pipelining
# To decode:
# qp -d string
# To encode:
# qp string
alias qpd='perl -MMIME::QuotedPrint -pe '\''$_=MIME::QuotedPrint::decode($_);'\'''
alias qpe='perl -MMIME::QuotedPrint -pe '\''$_=MIME::QuotedPrint::encode($_);'\'''
function qp {
if [[ "$1" = "-d" ]]
then