Skip to content

Instantly share code, notes, and snippets.

@dave-kennedy
dave-kennedy / demo.html
Last active February 20, 2024 17:43
Flyout menus for Bootstrap 4
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Bootstrap flyout demo</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="flyout.css" rel="stylesheet">
</head>
<body>
" source: https://stackoverflow.com/a/24046914/2571881
let s:comment_map = {
\ "c": '\/\/',
\ "cpp": '\/\/',
\ "go": '\/\/',
\ "java": '\/\/',
\ "javascript": '\/\/',
\ "lua": '--',
\ "scala": '\/\/',
\ "php": '\/\/',
@dave-kennedy
dave-kennedy / Dockerfile
Created January 16, 2022 16:58
Dockerfile for Nextcloud development
# Copied from https://github.com/nextcloud/docker/tree/master/23/apache/Dockerfile
FROM php:8.0-apache-bullseye
# entrypoint.sh and cron.sh dependencies
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
rsync \
bzip2 \
@dave-kennedy
dave-kennedy / vnc.sh
Last active December 16, 2021 15:42
Bash script for controlling VNC sessions
#!/usr/bin/env bash
display_help() {
echo "Usage: `basename "$0"` OPTIONS ACTION
Options must be specified before any action, and only one action may be specified.
Options:
-g | --geometry size specify VNC session display size
@dave-kennedy
dave-kennedy / listen.py
Last active February 10, 2020 00:47
Python HTTP server
#!/usr/bin/env python3
# This script creates an HTTP server at http://localhost:8080 and serves files
# based on the request path and query string.
# If you don't need to parse the query string, then you can create an HTTP
# server that serves files relative to the current directory with:
#
# $ python3 -m http.server
@dave-kennedy
dave-kennedy / colors.js
Created April 20, 2018 16:59
Color palette randomizer
$(function () {
// http://www.colourlovers.com/palettes/most-loved/all-time/meta
let colorPalettes = [
['#69D2E7', '#A7DBD8', '#E0E4CC', '#F38630', '#FA6900'],
['#FE4365', '#FC9D9A', '#F9CDAD', '#C8C8A9', '#83AF9B'],
['#ECD078', '#D95B43', '#C02942', '#542437', '#53777A'],
['#CFF09E', '#A8DBA8', '#79BD9A', '#3B8686', '#0B486B'],
['#556270', '#4ECDC4', '#C7F464', '#FF6B6B', '#C44D58'],
['#774F38', '#E08E79', '#F1D4AF', '#ECE5CE', '#C5E0DC'],
['#E8DDCB', '#CDB380', '#036564', '#033649', '#031634'],
@dave-kennedy
dave-kennedy / edit-with-vim.reg
Last active March 6, 2018 20:46
Vim context menu entry for Windows
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\*]
[HKEY_CURRENT_USER\Software\Classes\*\shell]
[HKEY_CURRENT_USER\Software\Classes\*\shell\gvim]
@="Edit with Vim"
"Icon"="C:\\Program Files (x86)\\Vim\\vim80\\gvim.exe"
@dave-kennedy
dave-kennedy / index.html
Created August 5, 2017 04:54
API request builder
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form>
<p>
<label>
URL: <input name="url">
@dave-kennedy
dave-kennedy / reboot.sh
Created November 1, 2017 19:28
CGI form
#!/bin/sh
read input
if [ -n "$input" -a "$input" = 'password=foobar' ]; then
echo -e 'Content-Type: text/html\n'
cat << EOF
<html>
<body>Rebooting...</body>
</html>
@dave-kennedy
dave-kennedy / http-get.js
Created June 22, 2017 00:18
Node scripts
var bl = require('bl'),
http = require('http');
function getResponse(url, callback) {
http.get(url, function (response) {
response.pipe(bl(function (err, data) {
if (err) {
return console.error(err);
}