Skip to content

Instantly share code, notes, and snippets.

View danmack's full-sized avatar

Dan Mack danmack

View GitHub Profile
@danmack
danmack / gist:f7ed5dd3cf4a39aa0a39f051f333ad43
Last active October 5, 2018 15:53
example bhyve json config for smartos
{
"brand": "bhyve",
"vcpus": "2",
"ram": "16384",
"alias": "centos-bhyve1",
"hostname": "centos-bhyve1",
"dns_domain": "example.com",
"resolvers": ["8.8.8.8", "8.8.4.4"],
"disks": [
{
[root@macktron ~]# uname -a
SunOS macktron 5.11 joyent_20180830T001556Z i86pc i386 i86pc
[root@macktron ~]# cat /etc/issue
*--+--*--*
|\ |\ |\ |\ J O Y E N T
| \| \| \| \ ##### #### # ##### ### # # TM
+--*--+--*--* # # # # # # # ## #
]
{
"nic_tag": "admin",
"ip": "172.22.1.3",
"netmask": "255.255.248.0",
"gateway": "172.22.0.253"
},
{
"nic_tag": "admin",
"ip": "172.22.18.252",
@danmack
danmack / final summary
Last active June 26, 2018 03:53
gzip vs pigz with-without hyper threading i7-3930k
[root@f292b233-6a5b-e858-898a-85d89db534c5 ~]# ministat -c 99.5 -s -w 60
trial.1 trial.2
x trial.1
+ trial.2
+------------------------------------------------------------+
|x +|
|x +|
|x +|
|x +|
|x +|
@danmack
danmack / gist:e6f82194b34e6cd8e6112fa8c6059a2a
Created June 21, 2018 00:25
sm-summary fails on minimal-64 image
# sm-summary fails with an error using the latest 2018-04-08 smartos-image
# error is:
[root@6e08a13d-1eb6-c5d6-c2ee-fea3793af583 ~]# sm-summary
* Gathering VM instance summary..
df: unknown option: B
Usage: df [-F FSType] [-abeghklmntPVvZ] [-o FSType-specific_options] [directory | block_device | resource]
[root@6e08a13d-1eb6-c5d6-c2ee-fea3793af583 ~]# grep df `which sm-summary`
vm_tmpused=$(df -B1 /tmp | awk '{ if ($1 ~ /swap/) printf("%d", $3/1024/1024) }');
SunOS Release 5.11 Version joyent_20180607T005809Z 64-bit
Copyright (c) 2010-2018, Joyent Inc. All rights reserved.
2018-06-13T23:39:3.394554+00:00 macktron rsyslogd3: No files configured to be monitored [try http://www.rsyslog.com/e/-3 ]
2018-06-13T23:39:31.397858+00:00 macktron genunix: [ID 540533 kern.notice] #015SunOS Release 5.11 Version joyent_20180607T005809Z 64-bit
2018-06-13T23:39:31.397864+00:00 macktron genunix: [ID 265948 kern.notice] Copyright (c) 2010-2018, Joyent Inc. All rights reserved.
2018-06-13T23:39:31.398046+00:00 macktron acpica: [ID 717010 kern.notice] ACPI: RSDP 0x00000000000F0490 000024 (v02 SUPERM)
2018-06-13T23:39:31.398049+00:00 macktron acpica: [ID 428659 kern.notice] ACPI: XSDT 0x00000000DDA2C0A0 0000C4 (v01 SUPERM SMCI--MB 01072009 AMI 00010013)
2018-06-13T23:39:31.398051+00:00 macktron acpica: [ID 940304 kern.notice] ACPI: FACP 0x00000000DDA3B9A0 00010C (v05 SUPERM SMCI--MB 01072009 AMI 00010013)
2018-06-13T23:39:31.398054+00:00 macktron acpica: [ID 736406 kern.notice] ACPI:
#!/usr/bin/env bash
# Loads and mounts an ISO over SMB via the
# SuperMicro IPMI web interface
#
# usage: supermicro-mount-iso.sh <ipmi-host> <smb-host> <path>
# e.g.: supermicro-mount-iso.sh 10.0.0.1 10.0.0.2 '\foo\bar\windows.iso'
set -x
@danmack
danmack / build-llvm-clang.bash
Last active February 22, 2018 15:56
another script to build llvm clang and friends
#!/bin/bash
# because building llvm/clang docs are bad (based on someone's blog post)
# don't forget commonly missed pre-reqs:
# - ncurses-devel, libxml2-devel, python, cmake, libedit-devel
version=5.0.1
base="llvm"
bits="cfe libcxx libcxxabi libunwind lldb clang-tools-extra"
echo -n "fetching "
for part in ${base} ${bits} ; do
@danmack
danmack / snip
Created November 21, 2017 17:22
simple
#+BEGIN_SRC emacs-lisp
(font-lock-add-keywords 'org-mode
'(("^ +\\([-*]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
#+END_SRC
use std::path::Path;
fn main() {
let path = Path::new("./package");
if path.exists() {
if path.is_dir() {
println!("{:?} is a directory", path);
} else {
println!("{:?} is not a directory", path);
}