Skip to content

Instantly share code, notes, and snippets.

View jmshoffs0812's full-sized avatar

Justin Shoffstall jmshoffs0812

  • Tallahassee, FL
View GitHub Profile
@jfqd
jfqd / z.bash
Created November 11, 2020 13:27
convenient login script for SmartOS zones (native, lx, kvm)
#!/usr/bin/bash
if [[ "$1" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]]; then
if [[ $(/usr/sbin/vmadm lookup uuid="$1" -j -o type | /opt/tools/bin/jq '.[][]') = "KVM" ]]; then
/usr/sbin/vmadm console "$1"
else
/usr/sbin/zlogin "$1"
fi
else
uuid=$(/usr/sbin/vmadm lookup alias="$1")
brand=$(/usr/sbin/vmadm lookup alias="$1" -j -o type | /opt/tools/bin/jq '.[][]' |sed 's/"//g')
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active July 20, 2024 05:29
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@danmack
danmack / gist:6d69a6d2ab08e6dbf8a1727e9c2267a0
Created December 5, 2018 16:32
SmartOS add disk to bhyve linux container
Adding a new disk to a bhyve vm takes a few steps.
1. increase the quota on the zfs dataset to accomodate the additional
space.
2. create a zvol inside the zone
3. stop the vm and update its configuration to reflect the change
4. start the vm, login and use the disk
# update quota
use "random"
use "collections"
class CreationFactory
let _desired: String
new create(d: String) =>
_desired = d
fun apply(c: String): Creation =>
@p7cq
p7cq / kvm-add-disk.json
Created December 22, 2015 16:29
SmartOS - Add a disk to an existing VM
{
"add_disks": [
{
"media": "disk",
"model": "virtio",
"nocreate": true,
"boot": false,
"path": "/dev/zvol/rdsk/tank0/s1node1",
"size": 20480
}
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@krestenkrab
krestenkrab / beam estones
Last active June 25, 2016 00:53
Running the estone test suite for Erjang vs BEAM.
EStone test completed
**** CPU speed UNKNOWN MHz ****
**** Total time 1.740884613333333 seconds ****
**** ESTONES = 260159.54 ****
{'ESTONES',2.601595e+05}
Title Millis Estone % Loops
list manipulation 52.07 29171.60 7 6400
small messages 391.62 7915.86 10 1515
@ibdknox
ibdknox / settings.clj
Created August 22, 2013 21:10
missing behaviors for making settings better
:editor.behaviors [:lt.plugins.auto-complete/auto-show-on-input]
:editor.keymap [:lt.plugins.auto-complete/auto-show-on-input]
@kellymclaughlin
kellymclaughlin / bitcask_merge.erl
Last active July 14, 2017 17:12
An Erlang module to induce Riak to merge all bitcask data directories. **WARNING** It is not advisable to use this on a production system. There could be significant impact to request latencies.
-module(bitcask_merge).
-export([merge_dirs/0]).
bitcask_data_dir() ->
bitcask_data_dir(application:get_env(riak_kv, multi_backend),
application:get_env(bitcask, data_root)).
bitcask_data_dir(undefined, undefined) ->
undefined;
@kellymclaughlin
kellymclaughlin / pb_status_anon.txt
Created September 28, 2012 21:18
How to get poolboy status for each Riak Vnode
PBStatusFun = fun() ->
VnodePids = [Pid || {_, Pid} <- riak_core_vnode_manager:all_index_pid(riak_kv_vnode)],
Links = [process_info(Pid, [links]) || Pid <- VnodePids],
WorkerPoolPids = [WPPid || [{links,[_, WPPid]}] <- Links],
WorkerPoolLinks = [process_info(Pid, [links]) || Pid <- WorkerPoolPids],
PoolboyPids = [PoolboyPid || [{links,[_, PoolboyPid]}] <- WorkerPoolLinks],
[poolboy:status(Pid) || Pid <- PoolboyPids]
end.
PBStatusFun = fun(Index) ->