Skip to content

Instantly share code, notes, and snippets.

View bahamas10's full-sized avatar

Dave Eddy bahamas10

View GitHub Profile
@bahamas10
bahamas10 / README.md
Created May 14, 2014 21:05
mock node-manta

replace

var manta = require('manta');

with

var manta = require('./mock-manta');
diff --git a/_posts/2014-05-22-crossplatform-implementation-of-which.md b/_posts/2014-05-22-crossplatform-implementation-of-which.md
index 223bc97..37235ee 100644
--- a/_posts/2014-05-22-crossplatform-implementation-of-which.md
+++ b/_posts/2014-05-22-crossplatform-implementation-of-which.md
@@ -28,7 +28,7 @@ binfind() {
local path path
IFS=: read -a paths <<< "$PATH"
for path in "${paths[@]}"; do
- path=$path/$1
+ path=${path:-.}/$1
@bahamas10
bahamas10 / readme.md
Created May 22, 2014 20:06
command command

command is a bash-builtin, that allows for finding aliases and functions (which may or may not use programs installed in $PATH).

$ type -a command
command is a shell builtin
command is /usr/bin/command
@bahamas10
bahamas10 / readme.md
Last active August 29, 2015 14:01
svcadm unexpected return codes

svcadm returns 0 unexpectedly for the restart and refresh methods

$ svcadm enable postfix; echo $?
svcadm: svc:/pkgsrc/postfix:default: Permission denied.
1
$ svcadm disable postfix; echo $?
svcadm: svc:/pkgsrc/postfix:default: Permission denied.
1
$ svcadm restart postfix; echo $?
@bahamas10
bahamas10 / readme.md
Created September 2, 2014 17:43
arrow
$ echo ▶
▶
@bahamas10
bahamas10 / setInterval.bash
Last active August 7, 2023 09:04
setInterval in bash
#!/usr/bin/env bash
#
# simple bash script to simulate JavaScript's setInterval (blocking)
#
# Author: Dave Eddy <dave@daveeddy.com>
# Date: September 27, 2014
# License: MIT
setInterval() {
local func=$1
@bahamas10
bahamas10 / faves.txt
Created October 24, 2014 22:40
faves output
dave - datadyne-hr sunos ~ $ faves /home/dave/backups/github/bahamas10/
posix-getopt (21)
latest (19)
access-log (10)
request (9)
strsplit (8)
colors (7)
exec (6)
async (6)
routes (6)
@bahamas10
bahamas10 / malloc-loop.c
Created December 4, 2014 19:18
malloc loop (cap memory smartos)
#include <stdlib.h>
#include <stdio.h>
#define MALLOC_SIZE (1 * 1024 * 1024) // 1mb
int main() {
int i = 0;
while (malloc(MALLOC_SIZE))
i++;
perror("malloc");
@bahamas10
bahamas10 / open-5k.c
Last active August 29, 2015 14:10
pfiles in zone
#include <fcntl.h>
#include <stdio.h>
#define FILE_TO_OPEN "/etc/passwd"
#define TIMES 5000
int main() {
int fd;
int i;
printf("pid: %d\n", getpid());
@bahamas10
bahamas10 / README.md
Created December 7, 2014 19:19
fire tv xbmc buffering and remote

XBMC/Kodi on Amazon Fire TV

Buffering

Add the following to advancedsettings.xml to eleminate sporadic buffering

cat /mnt/shell/emulated/0/Android/data/org.xbmc.xbmc/files/.xbmc/userdata/advancedsettings.xml