Skip to content

Instantly share code, notes, and snippets.

@ehrmann
ehrmann / openwrt-sprint-notes.md
Last active February 9, 2021 00:10
OpenWRT Sprint Hotspot Notes

OpenWRT compatible devices

Sprint-compatible LTE modems

MC vs EM is the form factor. Most devices are USB devices that the USB interface on MiniPCIe. SIM support works by wiring pins from the SIM card to standard pins on the PCIe interface. 74xx models use USB3, but some boards don't support this. As a workaround, you can tape over USB3 pins, forcing the device to USB2.

  • EM7455
  • MC7455
@ehrmann
ehrmann / gist:ca4454924e4fcf88c0a76c0b3752194b
Created July 5, 2018 16:46
Java pngtastic zopfli compression
public byte[] gzipData(byte[] blob) {
Buffer compressedData = zopfli.compress(new Options(Options.BlockSplitting.FIRST, 15), blob);
ByteBuffer gzipBuffer = ByteBuffer.allocate(compressedData.getSize() - 6 + 18);
gzipBuffer.order(ByteOrder.LITTLE_ENDIAN);
gzipBuffer.put((byte) 0x1f);
gzipBuffer.put((byte) 0x8b);
gzipBuffer.put((byte) 8);
gzipBuffer.put((byte) 0);
gzipBuffer.putInt(0);
$ curl -G 'https://query.yahooapis.com/v1/public/yql' \
> --data-urlencode 'env=store://datatables.org/alltableswithkeys' \
> --data-urlencode 'format=json' \
> --data-urlencode 'q=select * from yahoo.finance.historicaldata where symbol = "NAS.OL" and startDate = "2016-08-03" and endDate = "2016-08-03"' | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 84 0 84 0 0 208 0 --:--:-- --:--:-- --:--:-- 208
{
"query": {
"count": 0,
Options:
-version Print the compiler version
-o dir Set the output directory for gen-* packages
(default: current directory)
-out dir Set the ouput location for generated files.
(no gen-* folder will be created)
-I dir Add a directory to the list of directories
searched for include directives
-nowarn Suppress all compiler warnings (BAD!)
-strict Strict compiler warnings on
@ehrmann
ehrmann / TreeHashExample.java
Created January 29, 2015 05:04
AWS TreeHash from stdin
// Based on http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html
// Modifications are licensed under the Apache License 2.0
import java.io.InputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
@ehrmann
ehrmann / gist:4c6aab2054f731af22fb
Created June 9, 2014 00:03
Print FreeBSD package installation date/time based on file access time
from subprocess import check_output
import os.path, time
import json
import re
packages = check_output(["pkg", "info"]).split("\n")
packages = [re.sub(r'\s.*', '', x) for x in packages if x]
result = {}
@ehrmann
ehrmann / etc_rc.conf
Last active August 29, 2015 14:00
Using www/py-graphite-web with uWSGI on FreeBSD
# /etc/rc.conf
# ...
# These settings set up a uWSGI Unix socket for webservers like Apache or Nginx
uwsgi_enable="YES"
uwsgi_flags="-L -M -p 3 --socket /tmp/uwsgi.sock --gid 80 --uid 80 --chdir /usr/local/share/graphite-web --wsgi-file /usr/local/etc/graphite/graphite.wsgi"
# Or for standalone uWSGI on port 8000
# uwsgi --http :8000 --chdir /usr/local/share/graphite-web --wsgi-file /usr/local/etc/graphite/graphite.wsgi