Skip to content

Instantly share code, notes, and snippets.

// chirp screw: parameterized on 0 <= t <= 1
t_steps = 500;
major_d = 50;
major_facets = 71;
minor_d = 4;
minor_facets = 17;
@Ovid
Ovid / SeKreT.pm
Created May 15, 2022 10:31
New test SQLite databases on the fly
# I needed to sure I was operating on pristine test databases
# every time my code called $test->schema (DBIx::Class and Test::Class::Moose).
# This handles that for me
package TestsFor::SeKreT {
use Test::Class::Moose;
use Less::Boilerplate; # gives me a sane version of Perl
use File::Copy qw(copy);
use File::Spec::Functions qw(catfile);
use SeKreT::Util::Data qw(
make_slug
@rivo
rivo / postgres.go
Last active July 7, 2024 14:28
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
#!/usr/bin/env perl
use strict;
use warnings;
use HiPi::Device::OneWire;
my @devices = HiPi::Device::OneWire->list_slaves();
for my $w1 ( @devices ) {
for ( qw( id family name description ) ) {
print qq($_ = $w1->{$_}\n);
@munen
munen / capture-templates.el
Created May 1, 2016 11:04
Create custom capture templates for emacs
(setq org-capture-templates
'(("t" "Todo" entry (file+headline (concat org-directory "inbox.org") "Tasks")
"* TODO %?\n %U\n %i\n %a")
("s" "Code Snippet" entry
(file (concat org-directory "snippets.org"))
;; Prompt for tag and language
"* %?\t%^g\n#+BEGIN_SRC %^{language}\n\n#+END_SRC")
("m" "Media" entry
(file+datetree (concat org-directory "media.org"))
"* %?\nURL: \nEntered on %U\n")))
@levlaz
levlaz / types_and_roles_demo.sql
Created March 28, 2016 19:11
Create Types and Roles If Not Exist in PostgreSQL
BEGIN;
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'task_status') THEN
create type task_status AS ENUM ('todo', 'doing', 'blocked', 'done');
END IF;
END
$$;
CREATE TABLE IF NOT EXISTS
@basuke
basuke / mosquitto.init.sh
Last active February 22, 2019 19:51
Amazon Linux Init script for mosquitto MQTT 3.1 broker.
#!/bin/bash
#
# mosquitto This shell script takes care of starting and stopping
# mosquitto (MQTT 3.1 broker) on Amazon Linux.
#
# chkconfig: - 58 74
# description: mosquitto is a MQTT 3.1 broker. \
# http://mosquitto.org/
### BEGIN INIT INFO
@melo
melo / .bash_prompt
Created October 12, 2010 23:56
My PS1 bash setup
#!/bin/bash
#
# PS1 magic
#
# Mostly copied from YUVAL KOGMAN version, added my own __git_ps1 stuff
# Original: http://gist.github.com/621452
#
# See video demo of this at http://vimeo.com/15789794
#
# To enable save as .bash_prompt in $HOME and add to .bashrc:
#!/bin/bash
_set_prompt () {
local exit=$?
#local black="30";
#local grey="31";
local red="31";
local green="32";