Skip to content

Instantly share code, notes, and snippets.

View hedenface's full-sized avatar

Bryan Heden hedenface

  • Heden Enterprises
  • Yorktown, VA
View GitHub Profile
@hedenface
hedenface / demo.c
Created February 3, 2021 01:31
Basic C-based CGI
/*
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 23:08
SublimeText3 Equal-sign Aligner Plugin
# 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 March 30, 2018 11:09
Nagios Configuration Syntax for Sublime Text 3
%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 March 29, 2018 21:37
Shared memory buffer between two processes
/*****************************
*
* 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 March 17, 2018 15:47
Kernel Message Queue Example
/*****************************
*
* queue.c
*
* Compile:
* gcc queue.c -o queue
*
* Execute:
* ./queue
*
@hedenface
hedenface / basic_flock_example.php
Created February 27, 2018 21:21
php: Basic flock() example
<?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`