Skip to content

Instantly share code, notes, and snippets.

@pnasrat
pnasrat / xhyve-freebsd-tutorial-1.md
Created June 23, 2016 16:06 — forked from tanb/xhyve-freebsd-tutorial-1.md
FreeBSD running on xhyve tutorial. (Appendix: Resize image with qemu. Create FreeBSD VM with qemu).

TL;DR

  • Create 5GB FreeBSD image.
  • Install FreeBSD on xhyve.
  • Mount host directory.

Requisites

@pnasrat
pnasrat / debugging-tools.md
Created June 20, 2016 20:54
RC Linux/UNIX debugging tool notes
  • ls
  • ps
  • pgrep
  • strace - used to trace system (kernel) calls
  • ltrace - used to trace library (C)
  • /proc filesystem - lots of information
  • /proc/
  • /proc//fd
  • lsof - list of open files including network
  • gdb - briefly
@pnasrat
pnasrat / Enter the hypervisor framework
Last active June 17, 2016 15:05
Debugging com.docker.hyperkit
(gdb) bt
#0 0x00000001002400ab in hv_vcpu_run () from /System/Library/Frameworks/Hypervisor.framework/Versions/A/Hypervisor
#1 0x00000001000054d9 in vmx_run ()
#2 0x0000000100023b78 in vcpu_thread ()
#3 0x00007fff954ed99d in _pthread_body () from /usr/lib/system/libsystem_pthread.dylib
#4 0x00007fff954ed91a in _pthread_start () from /usr/lib/system/libsystem_pthread.dylib
#5 0x00007fff954eb351 in thread_start () from /usr/lib/system/libsystem_pthread.dylib
#6 0x0000000000000000 in ?? ()
@pnasrat
pnasrat / expecting.md
Created June 9, 2016 15:54 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
#!/usr/bin/env expect
spawn "./hyperkitrun.sh"
set pid [exp_pid]
expect "tc@box:~$"
send "sudo halt\r\n";
expect {
timeout {exec kill -9 $pid; exit 1}
"reboot: System halted"
}
-Usage: xhyve [-behuwxMACHPWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]
- [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] -f <fw>
+Usage: com.docker.hyperkit [-behuwxMACHPWY] [-c vcpus] [-F <pidfile>] [-g <gdb port>] [-l <lpc>]
+ [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] -f <fw>
-A: create ACPI tables
-c: # cpus (default 1)
-C: include guest memory in core file
-e: exit on unhandled I/O access
-f: firmware
+ -F: pidfile
Availability Uptime
90.0% 36 day 12 hours
95.0% 18 days, 6 hours
99.0% 87 hours, 36 minutes
99.50% 43 hours, 48 minutes
99.90% 8 hours, 48 minutes
99.99% 52 minutes, 33 seconds
99.999% 5 minutes, 15 seconds
99.9999% 32 seconds
@pnasrat
pnasrat / shell_intro.md
Last active May 5, 2016 15:30 — forked from niftynei/shell_intro.md
intro to shell, a script

what is a shell?

Shell is a programming environment that terminal runs. it's a text based GUI for interacting with your system.

what is shell good for?

shell can give you information about your system, allows you to modify and run programs. let's try something

say "hello pris"

@pnasrat
pnasrat / Docker.app.txt
Last active April 18, 2016 21:41
OSS from Docker for mac components
./Contents/_CodeSignature/CodeResources
./Contents/Frameworks/HockeySDK.framework/Versions/A/_CodeSignature/CodeResources
./Contents/Frameworks/HockeySDK.framework/Versions/A/HockeySDK
./Contents/Frameworks/HockeySDK.framework/Versions/A/Resources/BITCrashReportUI.nib
./Contents/Frameworks/HockeySDK.framework/Versions/A/Resources/BITFeedbackWindowController.nib
./Contents/Frameworks/HockeySDK.framework/Versions/A/Resources/de.lproj/HockeySDK.strings
./Contents/Frameworks/HockeySDK.framework/Versions/A/Resources/en.lproj/HockeySDK.strings
./Contents/Frameworks/HockeySDK.framework/Versions/A/Resources/fi.lproj/HockeySDK.strings
./Contents/Frameworks/HockeySDK.framework/Versions/A/Resources/fr.lproj/HockeySDK.strings
./Contents/Frameworks/HockeySDK.framework/Versions/A/Resources/Info.plist