Skip to content

Instantly share code, notes, and snippets.

View p34eu's full-sized avatar
💭
I may be slow to respond.

jq p34eu

💭
I may be slow to respond.
View GitHub Profile
@p34eu
p34eu / gist:548444878d6985fb9ebfb052703d3de8
Created June 4, 2021 18:14 — forked from JoshuaCarroll/gist:f6b2c64992dfe23feed49a117f5d1a43
Regular expression (regex) for non-US amateur radio call signs
All amateur radio call signs:
[a-zA-Z0-9]{1,3}[0123456789][a-zA-Z0-9]{0,3}[a-zA-Z]
Non-US call signs:
\b(?!K)(?!k)(?!N)(?!n)(?!W)(?!w)(?!A[A-L])(?!a[a-l])[a-zA-Z0-9][a-zA-Z0-9]?[a-zA-Z0-9]?[0123456789][a-zA-Z0-9][a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?\b
US call signs:
[AKNWaknw][a-zA-Z]{0,2}[0123456789][a-zA-Z]{1,3}
@p34eu
p34eu / gist:86fe12386e1ff326eb0682e86bbe30bb
Last active July 7, 2018 08:24
jQuery html5 drag drop file upload progress preview mime list json response event csrf-token
(function ($) {
//based on that nice demo at https://html5demos.com/dnd-upload/
$.fn.upl = function (options) {
var tests = {
filereader: typeof FileReader != 'undefined',
dnd: 'draggable' in document.createElement('span'),
formdata: !!window.FormData,
progress: "upload" in new XMLHttpRequest
},
@p34eu
p34eu / queue-main.service
Created February 1, 2017 13:33
Laravel queue worker using systemd
# Laravel queue worker using systemd
# ----------------------------------
#
# /lib/systemd/system/queue-main.service
#
# run this command to enable service:
# systemctl enable queue-main.service
[Unit]
Description=Laravel queue worker
#!/bin/bash
##
# File:
# nginx_modsite
# Description:
# Provides a basic script to automate enabling and disabling websites found
# in the default configuration directories:
# /etc/nginx/sites-available and /etc/nginx/sites-enabled
# For easy access to this script, copy it into the directory:
var querystring=(function (s) {
if (s === "")return {};var c = {};for (var e = 0; e < s.length; ++e) {
var f = s[e].split("=");if (f.length !== 2)continue;c[f[0]] = decodeURIComponent(f[1].replace(/\+/g, " "));
}return c;
})(window.location.search.substr(1).split("&"));
/*
<a class="btn btn-link" data-checkall=".chst">check all</a>
<a class="btn btn-link" data-uncheckall=".chst">uncheck all</a>
*/
var changeBoxesEvent = document.createEvent('HTMLEvents');
changeBoxesEvent.initEvent('change', true, false);
var t = document.querySelectorAll('[data-uncheckall]');
if (t) {
<sql>
CREATE FUNCTION `alphanum`( str CHAR(255) ) RETURNS char(255) CHARSET utf8
BEGIN
DECLARE i, len SMALLINT DEFAULT 1;
DECLARE ret CHAR(255) DEFAULT '';
DECLARE c CHAR(1);
SET len = CHAR_LENGTH( str );
REPEAT
BEGIN
SET c = MID( str, i, 1 );