Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>Write to file</title>
</head>
<body>
<?php
if (isset($_POST['userdata'])) {
$userdata = trim($_POST['userdata']);
@kenbarbour
kenbarbour / .vimrc
Last active September 28, 2023 14:53
An iteration of my vimrc file. I keep this and other dotfiles maintained in source control
syntax enable
filetype plugin on "netrw packaged w/ vim core
set backspace=indent,eol,start
set number "Line numbers
" set relativenumber "Show line # relative to current line
set mouse=a "Use mouse to scroll
set exrc "execute vimrc within pwd
set clipboard=unnamed "share clipboard with X sessions
set autoindent "Automatically indent new lines
#include "windspeed.h"
/**
* Interrupt Service Routine to run when a hall effect sensor triggers a rising interrupt
*/
void windspeed_isr(void)
{
windspeed_revs++;
}
@kenbarbour
kenbarbour / buildkeys.sh
Created February 24, 2017 16:46
Placed in my ~/.ssh directory and run when a new .pub file is added. Creates an authorized_keys file with the contents of every .pub file in the directory
#!/bin/bash
KEYFILES=~/.ssh/*.pub #All public key files in git/.ssh
AUTHFILE=~/.ssh/authorized_keys #File to store authorized keys
echo 'Building authorized keys file'
# Clear current authorized keys file
if [ -e $AUTHFILE ]; then
@kenbarbour
kenbarbour / pastebin.sh
Created February 8, 2017 14:12 — forked from yevgenko/pastebin.sh
PASTEBIN.COM BASH SCRIPT – PASTE DIRECTLY FROM YOUR TERMINAL
#!/bin/bash
# Paste at Pastebin.com using command line (browsers are slow, right?)
# coder : Anil Dewani
# date : Novemeber 7, 2010
#help function
howto()
{
echo "\
Pastebin.com Bash Script \
@kenbarbour
kenbarbour / skeleton.sh
Last active July 30, 2018 03:16
A basic skeleton bash script with a usage statement
#!/bin/bash
##
## Skeleton Script that does nothing useful. This is the script that I copy
## when I make other scripts.
##
## Usage: _PROG_ [OPTIONS]
##
## Options:
## -h --help Display help message and exit
##
@kenbarbour
kenbarbour / deploy.sh
Created November 8, 2016 14:01
A simple deploy script to pull from git before rsyncing to servers
#!/bin/bash
set -e # Stop on any error
# Path on this machine to source code (omit trailing slash)
SOURCEPATH=~/deploy/myproject
# Path on remote server to place source code (omit trailing slash)
DESTPATH=/var/www/myproject
# Space separated list of hosts
@kenbarbour
kenbarbour / OpenSCAD.mk
Last active January 8, 2022 15:50
Generic Makefile for OpenSCAD
# This Makefile generates files for printing SCAD documents
# Copyright (C) 2016 Kenneth Barbour | kenbarbour.com
# License: GNU GPL v3 (or later)
## make all Generate STL for each SCAD file
## make gcode Generate gcode for each SCAD file
## SCAD Compiler
SCADC?=openscad
## Slicing program