Skip to content

Instantly share code, notes, and snippets.

jamchamb /
Last active September 9, 2018 15:01
How to set up Android Studio on Fedora Workstation with a network home mount

Android Studio likes to run in Oracle's runtime, and the cache and config files it stores in the user's home directory (including virtual device images) start to eat up too much space on our network home mount. Here's how to set up Oracle JDK and Android Studio on Fedora Workstation, and configure Android Studio to keep its files on a local drive.

Setting up Oracle JDK

Get the latest Java SE Development Kit "critical patch update" release from, and if OpenJDK is already installed then configure these alternatives:

jamchamb / phd
Last active March 28, 2016 23:20
Centos init.d script for Phabricator PHD
# Provides: phd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: phabricator
# Description: manages phd
jamchamb /
Last active January 11, 2020 22:53
Phabricator automatic backup script
# Backup Phabricator database, storage engine, and config files
# NOTE: This script is to be run by cron. See /etc/cron.d/phabricator
# Don't use unset variables
set -u
# Exit if any commands fail (unless they begin a pipe, etc.)
set -e
# Output an error message and set the errors flag
jamchamb / node-https-server.js
Created July 18, 2017 18:37
Simple Node HTTPS server
const tls = require('tls')
const fs = require("fs")
const https = require("https")
$ openssl req -newkey rsa:2048 -new -nodes -x509 -days 365 \
-keyout key.pem -out cert.pem
const options = {
key: fs.readFileSync('key.pem'),
#!/usr/bin/env python2
import argparse
# Debug register group names
jamchamb / interactive-websocket.html
Last active August 20, 2021 03:23
Basic interactive WebSocket page based on echo test
<!doctype HTML>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
//var wsUri = 'ws://';
var output;
<title>CORS Test</title>
var xhr = new XMLHttpRequest();
#!/usr/bin/env python3
import hmac
import os
SECRET = b'secret'
def test(host, in_hmac, nonce=None):
secret = SECRET
#!/usr/bin/env python3
import argparse
import struct
# little endian, 32-bit words
# Could check for magic 0x01020304 / 0x04030201 to determine endianness
ENDI = '<'
WORD_SZ = struct.calcsize(WORD_PAT)
#!/usr/bin/env python
# Based on
# generate server.pem with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python
# then in your browser, visit:
# https://localhost:4443
import argparse
import BaseHTTPServer, SimpleHTTPServer