Skip to content

Instantly share code, notes, and snippets.

Avatar
🧙
I put on my robe and wizard hat

Bryan Heden hedenface

🧙
I put on my robe and wizard hat
  • Heden Enterprises
  • St. Paul, Minnesota
View GitHub Profile
@hedenface
hedenface / demo.c
Created Feb 3, 2021
Basic C-based CGI
View demo.c
/*
1. compile with: `gcc -Wall -o demo.cgi demo.c`
2. ensure your cgi is enabled (`sudo a2enmod cgi` if using apache)
3. copy demo to your cgi-bin (possibly /usr/lib/cgi-bin/) (check your
server configuration)
4. load page (http://localhost/cgi-bin/demo.cgi?key1=val1&key2=val2)
*/
#include <stdio.h>
#include <stdlib.h>
@hedenface
hedenface / EqualizerCommand.py
Created May 6, 2018
SublimeText3 Equal-sign Aligner Plugin
View EqualizerCommand.py
# put in ~/.config/sublime-text-3/Packages/User/EqualizerCommand.py
#
# I use the following keybindings (Preferences > Key-Bindings > ('User' bindings - on the right side)):
#
# {
# "keys": ["ctrl+shift+e"],
# "command": "equalizer"
# }
#
# Given a selection of text in the edit view, it will align all of the right-most
@hedenface
hedenface / nagios.sublime-syntax
Created Mar 30, 2018
Nagios Configuration Syntax for Sublime Text 3
View nagios.sublime-syntax
%YAML 1.2
---
name: Nagios Configuration
file_extensions:
- cfg
scope: text.nagios
contexts:
main:
# Macros begin and end with $ and are all capital letters (and underscore and numbers)
@hedenface
hedenface / shared_mem_buffer.c
Created Mar 29, 2018
Shared memory buffer between two processes
View shared_mem_buffer.c
/*****************************
*
* shared_mem_buffer.c
*
* Compile:
* gcc shared_mem_buffer.c -lpthread -lrt -o shared_mem_buffer
*
* Execute:
* ./shared_mem_buffer
*
@hedenface
hedenface / queue.c
Created Mar 17, 2018
Kernel Message Queue Example
View queue.c
/*****************************
*
* queue.c
*
* Compile:
* gcc queue.c -o queue
*
* Execute:
* ./queue
*
@hedenface
hedenface / basic_flock_example.php
Created Feb 27, 2018
php: Basic flock() example
View basic_flock_example.php
<?php
/*
basic flock() example
1. open 2 terminals
2. in first terminal, execute `./basic_flock_example.php --first`
3. then *quickly* in second terminal, execute `./basic_flock_example --second`
4. once both have finished, view the output file: `cat file`