Skip to content

Instantly share code, notes, and snippets.

@bahamat
bahamat / Makefile
Last active October 12, 2016 19:13 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@bahamat
bahamat / quine.js
Last active August 29, 2015 14:19 — forked from bahamas10/quine.js
#!/usr/bin/env node
var util = require("util");
var source = [
'#!/usr/bin/env node',
'',
'var util = require("util");',
'',
'var source = [',
@bahamat
bahamat / quine.bash
Last active August 29, 2015 14:19 — forked from bahamas10/quine.bash
#!/usr/bin/env bash
s=(
'#!/usr/bin/env bash'
''
's=('
')'
''
'q=$(printf "\x27")'
'for ((i = 0; i < 3; i++ )); do'
This file has been truncated, but you can view the full file.
PCRE version 8.36 2014-09-26
/([^\s]+)\-([0-9][^\s;]+).*[\s;]/
0verkill-0.16nb1;0verkill is bloody 2D action deathmatch-like game in ASCII-ART
0: 0verkill-0.16nb1;0verkill is bloody 2D action deathmatch-like game in
1: 0verkill
2: 0.16nb1
2vcard-0.5nb3;Convert an addressbook to the popular VCARD file format
0: 2vcard-0.5nb3;Convert an addressbook to the popular VCARD file
1: 2vcard
@bahamat
bahamat / dl.cf
Last active August 29, 2015 14:17
Cfengine bundle to download a file.
body common control {
bundlesequence => { "dl" };
}
bundle agent dl
{
vars:
"file" string => "cfengine-3.6.5.tar.gz";
@bahamat
bahamat / gist:c154b59ea1c5710e141c
Last active December 20, 2020 01:06 — forked from bdha/gist:c456cf6e5484ea5ad256
haskell ghc on smartos
@bahamat
bahamat / gist:851c24b6d1a0de0e4f10
Last active August 29, 2015 14:10
CFEngine health check example
classes:
named_is_running::
"zone_data_is_healthy" expression => returnszero("/usr/bin/host -t soa digitalelf.net 127.0.0.1","noshell");
reports:
debian.named_is_running.zone_data_is_healthy::
"Zone data is healthy";
#!/bin/bash
# Copyright 2014 Brian Bennett <bahamat@digitalelf.net>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@bahamat
bahamat / gist:7c4abade72d674e34281
Last active December 20, 2020 01:05
Magical quoting with printf %q
$ echo quote what? ; read quoteme ; printf %q "$quoteme" ; echo
quote what?
The horse said "$)#*@(!!%" when he stubbed his hoof.
The\ horse\ said\ \"\$\)#\*@\(\!\!%\"\ when\ he\ stubbed\ his\ hoof.
$
@bahamat
bahamat / dpkgup.cf
Last active August 29, 2015 14:06
A cfengine bundle to upgrade all or a list of packages on a Debian system.
bundle agent dpkgup(p_list) {
vars:
done_with_classes.package_list_provided::
"pkg_list" string => join(" ", p_list), policy => "free";
done_with_classes.!package_list_provided::
"pkg_list" string => "", policy => "free";
done_with_classes::