Skip to content

Instantly share code, notes, and snippets.

🚎
On fire

David Parsons Orc

🚎
On fire
Block or report user

Report or block Orc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Orc
Orc / orphans.sh
Last active Mar 30, 2019
orphans: a q&d shell script to look for orphan functions in my code
View orphans.sh
#! /bin/sh
#
# Find functions that are defined but not referenced in a body of C code
test -f tags || ctags -M *.c
test -f tags || exit 1
FILES=`awk -F' ' '{print $2}' < tags | sort |uniq`
@Orc
Orc / tgoto.c
Created Mar 27, 2019
A tgoto() implementation for systems that don't have termcap
View tgoto.c
/*
* partial implementation of termlib's tgoto() function, with
* the optimization of caching compiled strings so they don't
* need to be recompiled evey time tgoto is called.
*
* "partial implementation" because I've got yet implemented %<xy
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@Orc
Orc / cu.c
Created Jul 18, 2017
A cu wrapper to fill the time between realizing that apple shipped an insufficiently privileged cu & being able to boot the machine into recovery mode for a `csrutil disable`
View cu.c
#include <stdio.h>
#include <unistd.h>
main(argc, argv)
char **argv;
{
/* to get around the goddamn macos privilege protection racket */
execv("/usr/bin/cu", argv);
perror("cu");
}
@Orc
Orc / pull.sh
Created May 19, 2017
create a git repository from a pile of tarballs (one tarball per commit, ordered cronologically, with the git dates forged to match the tarball dates)
View pull.sh
#! /bin/ksh
#
extractomatic() {
tarball=$1
first_in_archive=`tar tzf $tarball | head -1`
path=`dirname ${first_in_archive}/thing`
when=`dateof $tarball`
export GIT_COMMITTER_DATE="$when"
@Orc
Orc / dateof.c
Created May 19, 2017
print a file date in a git-aware form (needed by pull.sh)
View dateof.c
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <libgen.h>
#include <time.h>
main(argc, argv)
char **argv;
@Orc
Orc / dehtml.c
Last active May 15, 2017
Q&D html stripper for mutt
View dehtml.c
#include <stdio.h>
#include <string.h>
actualspace(register c)
{
return (c=='\r') || (c=='\n') || isspace(c);
}
int
@Orc
Orc / md5s.c
Last active Apr 25, 2017
Q&D md5sum clone that uses Solar Designer's md5 implementation
View md5s.c
/* Q&D md5sum clone that uses Solar Designer's md5 implementation */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "md5.h"
@Orc
Orc / mkshar.sh
Created Apr 10, 2017
A tiny sharfile generator that uses base64 to encode/decode (for redhat Linux; base64 is in coreutils, which is an rpm prerequisite so it's more likely to always be there)
View mkshar.sh
#! /bin/sh
#
# mkshar: make a shar file
#
usage() {
echo "usage: $0 [--rc file] payload [...]" 1>&2
exit 1
}
@Orc
Orc / cidr.c
Created Mar 31, 2017
A little program that converts a cidr ip/size into a base/mask pair for tcp wrappers
View cidr.c
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdarg.h>
#include <string.h>
#include <libgen.h>
#include <unistd.h>
#include <stdlib.h>
@Orc
Orc / mkdio.h++
Last active Oct 29, 2018
c++ header for discount -- trivially tested (the header compiles, a open/format test program works)
View mkdio.h++
#ifndef _MKDIO_CXX
#define _MKDIO_CXX
extern "C" {
#include <stdio.h>
#include <mkdio.h>
}
class MKIOT {
protected:
You can’t perform that action at this time.