Skip to content

Instantly share code, notes, and snippets.

View syntactician's full-sized avatar

Edward Hernández syntactician

View GitHub Profile
#define _BSD_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <sys/time.h>
#include <time.h>
#include <sys/types.h>
#include <assert.h>
#include "b64.h"
#include "hex.h"
#include "util.h"
#define INPUT (unsigned char *) \
"49276d206b696c6c696e6720796f757220627261696e206c" \
"696b65206120706f69736f6e6f7573206d757368726f6f6d"
#define OUTPUT (unsigned char *) \
"SSdtIGtpbGxpbmcgeW91ciBicmFpbiBs" \
#define _BSD_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <sys/time.h>
#include <time.h>
#include <sys/types.h>
/* See LICENSE file for copyright and license details. */
/*
* appearance
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
char font[] = "Liberation Mono:pixelsize=15:antialias=true:autohint=true";
int borderpx = 20;
/* user and group to drop privileges to */
static const char *user = "nobody";
static const char *group = "nogroup";
static const char *colorname[NUMCOLS] = {
[INIT] = "#3a3a3a", /* after initialization */
[INPUT] = "#4e4e4e", /* during input */
[FAILED] = "#d68787", /* wrong password */
};
/* See LICENSE file for copyright and license details. */
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "Liberation Mono:size=10" };
static const char dmenufont[] = "Liberation Mono:size=10";
static const char col_gray1[] = "#3a3a3a";
@syntactician
syntactician / ls.c
Last active February 7, 2017 09:29
#include <stdio.h>
#include <unistd.h>
#define LS "/bin/ls"
#define FILEPATH "./lusers"
#define MESSAGE "\
WARNING! You have put my binary directory ahead of the system's in your $PATH. \
While flattering, this is considered unsafe. This will execute my \
binaries rather than the system's in the case of name collisions. Please, \
append it to the end of your $PATH, instead. This incident will be reported."
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/wait.h>
/* sysexits.h conventions */
{
"1": 0,
"2": 673,
"3": 690,
"4": 707,
"5": 724,
"6": 741,
"7": 758,
"8": 775,
"9": 793,
@syntactician
syntactician / POSIXcheck.sh
Last active December 6, 2016 02:04
check presence of POSIX utilities
#!/bin/sh
POSIX="admin alias ar asa at awk basename batch bc bg break c99 cal cat cd cflow chgrp chmod chown cksum cmp colon comm command compress continue cp crontab csplit ctags cut cxref date dd delta df diff dirname dot du echo ed env eval ex exec exit expand export expr false fc fg file find fold fort77 fuser gencat get getconf getopts grep hash head iconv id ipcm ipcs jobs join kill lex link ln locale localedef logger logname lp ls m4 mailx make man mesg mkdir mkfifo more mv newgrp nice nl nm nohup od paste patch pathchk pax pr printf prs ps pwd qalter qdel qhold qmove qmsg qrerum qrls qselect qsig qstat qsub read readonly renice return rm rmdel rmdir sact sccs sed set sh shift sleep sort split strings strip stty tabs tail talk tee test time times touch tput tr trap true tsort tty type ulimit umask unalias uname uncompress unexpand unget uniq unlink unset uuccp uudecode uuencode uustate uux val vi wait wc what who write xargs yacc zcat"
for UTILITY in $POSIX; do
command -v $UTILITY >/dev/null 2>&1 &&