Skip to content

Instantly share code, notes, and snippets.

View shrimpwagon's full-sized avatar

Shawn Welch shrimpwagon

  • Summerville, SC
View GitHub Profile
@chrisjonesio
chrisjonesio / emoji_flags.php
Created September 15, 2018 14:53
An array of country flag emojis for PHP 7+ unicode codepoint escape syntax
<?php
// ISO country code source: https://en.wikipedia.org/wiki/ISO_3166-1
// Emoji unicode codes: http://unicode.org/emoji/charts/full-emoji-list.html#country-flag
// An array to hold all the countries
$emoji_flags = array();
// Now, all the country flags as emojis
$emoji_flags["AD"] = "\u{1F1E6}\u{1F1E9}";
$emoji_flags["AE"] = "\u{1F1E6}\u{1F1EA}";
@andkirby
andkirby / slack.sh
Last active June 5, 2024 09:55
Shell/Bash script for sending slack messages.
#!/usr/bin/env bash
####################################################################################
# Slack Bash console script for sending messages.
####################################################################################
# Installation
# $ curl -s https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack
# $ chmod +x /usr/bin/slack
####################################################################################
# USAGE
# Send message to slack channel/user
@AGWA
AGWA / rpi-hdmi.sh
Last active June 9, 2024 15:15
Enable and disable the HDMI port on the Raspberry Pi: `rpi-hdmi on` to turn on, `rpi-hdmi off` to turn off. X is properly reinitialized when re-enabling.
#!/bin/sh
# Enable and disable HDMI output on the Raspberry Pi
is_off ()
{
tvservice -s | grep "TV is off" >/dev/null
}
case $1 in
/*
* Changes by git-commit on GitHub.
* Fixed error that was introduced by blindly parsing the next line as a
* command if delimiter character was found. This let to issues if a
* delimiter was set and the next line was a comment,
* leading to a missing command in the sql script.
*/
/*
* Added additional null checks when closing the ResultSet and Statements.
*
@ck-on
ck-on / ocp.php
Last active September 5, 2024 01:35
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@revolunet
revolunet / lzw_encoder.js
Created February 25, 2011 14:55
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];