Skip to content

Instantly share code, notes, and snippets.

View danmack's full-sized avatar

Dan Mack danmack

View GitHub Profile
@danmack
danmack / gist:a7570a3822525d70d83f4aa07bb4dbd7
Created August 19, 2016 22:59
dtrace powershell get-process on triton/lxc
root@171137a2-b0ef-e9ff-8b63-cb31c060a4fa:~# uname -a ; /native/usr/sbin/dtrace -n lx-syscall:::entry'/progenyof($target)/{@[probefunc] = count()}' -c "powershell Get-Process > /dev/null"
Linux 171137a2-b0ef-e9ff-8b63-cb31c060a4fa 4.3.0 BrandZ virtual linux x86_64 x86_64 x86_64 GNU/Linux
dtrace: description 'lx-syscall:::entry' matched 676 probes
dtrace: pid 26066 has exited
arch_prctl 1
exit_group 1
mincore 1
mlock 1
set_tid_address 1
PS /root> Get-Process
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
0 0 0 1 0.005 24988 988 agetty
0 0 0
[root@olive-sdc ~]# dtrace -n entry'/progenyof($target)/{@[probefunc] = count()}' -c 'ps'
dtrace: description 'entry' matched 911 probes
PID TTY TIME CMD
45890 pts/8 0:00 bash
45941 pts/8 0:00 ps
45940 pts/8 0:00 dtrace
dtrace: pid 45941 has exited
access 1
exece 1

Keybase proof

I hereby claim:

  • I am danmack on github.
  • I am danmack (https://keybase.io/danmack) on keybase.
  • I have a public key ASCRfIZBX0yXTwJjqwj4dCoeoYq2RnPDNGlYgSKpsB_X-Ao

To claim this, I am signing this object:

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);
}
@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
@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
#!/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
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:
@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) }');