Skip to content

Instantly share code, notes, and snippets.

zyphlar / rgb-hsv-conversion.php
Last active November 16, 2023 20:49
RGB and HSV conversion in PHP
// note: some of these are written with $this so they work inside classes.
// you could easily rewrite this to be a general function outside a class.
// sorry for the inconsistent tabs
// adapted from: via
class MyClass
// usage: $this->hexColorMod("#aa00ff", -0.2); // darker by 20%
// returns: #8700cc
zyphlar /
Last active September 28, 2023 19:04
QGIS user expression to separate and format streets from addresses (updated for latest Python)
import qgis.core
import qgis.gui
import re
# This will keep street names like SR 574A as SR 574A however
# will lowercase other number-digit suffixes with <2 or >4 numbers
# or >1 suffix-letters, like 12th Street or 243rd Ave.
zyphlar / fatsecret.rb
Created May 31, 2012 10:01
FatSecret API in Ruby on Rails example
require "openssl"
require "base64"
require "digest/md5"
require "net/http"
class String
def esc
CGI.escape(self).gsub("%7E", "~").gsub("+", "%20")
zyphlar / generatePassword.php
Created December 20, 2014 22:36
Generating secure passwords in PHP
// usage: $newpassword = generatePassword(12); // for a 12-char password, upper/lower/numbers.
// functions that use rand() or mt_rand() are not secure according to the PHP manual.
function getRandomBytes($nbBytes = 32)
$bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
if (false !== $bytes && true === $strong) {
return $bytes;
function editAction(){
$form = $this->createForm(new Forms\UserType($userConfig), $user);
if($form->isValid()) {
$em = $this->getDoctrine()->getManager();
zyphlar /
Created December 9, 2021 19:22
cylon/loop led scanner flasher routine in bash
zyphlar / gist:b980f22b9b2c47935628
Last active December 9, 2021 17:46
Talking about makerspace management and hackerspaces
11:31 AM <LesaraRose> Sorry. I have a lot of questions lol
11:33 AM <TheWill> hardest: inspiring volunteers. work: being everybody's surrogate parent because they were ~20yo and antisocial and didn't know how to avoid generating a storm of drama everywhere they go
11:34 AM <TheWill> the idea of "everybody contributes towards the common good" is great until you're dealing with people who can't resolve the "who washes the dishes" conflict with their roommate
11:35 AM <TheWill> in other words a balance of demographics is vastly superior even if less comfortable
11:36 AM <TheWill> having a paid community manager is in my opinion the most effective way to reduce drama
11:36 AM <TheWill> and burnout
11:40 AM <myself> Hardest: Getting our external image to reflect the diversity of stuff actually happening in the space. Our technical people get more attention than our artistic people, so it takes a lot of work to bring in more artistic people. Yet, when we take both technical and artistic projects to show off at an e
zyphlar / chimera-bylaws.txt
Created April 23, 2020 23:23
chimera bylaws
Bylaws of
Chimera Art Space
Article 1 - Offices
Section 1. Principal Office
The principal office of the corporation is located in Sonoma County, State of California.
Section 2. Change of Address
The designation of the county or state of the corporation's principal office may be changed by amendment of these bylaws. The board of directors may change the principal office from one location to another within the named county by noting the changed address and effective date below, and such changes of address shall not be deemed, nor require, an amendment of these bylaws:
zyphlar / asterisk-logfile-analyzer.php
Created June 26, 2012 10:19
Cheap and Dirty Asterisk Logfile Analysis
/* Cheap and Dirty Asterisk Logfile Analysis
* by Will Bradley,
* Released to the public domain, 6-26-2012
* To install, modify the $dbname and other variables,
* create the MySQL database, user, and permissions,
* and double-check the asterisk logfile paths/formats below.
* This is a very cheap script, use at your own risk!
zyphlar / dynamic-thermometer.html
Created December 22, 2019 22:49
dynamic fundraising thermometer from google docs / spreadsheet
<script type="text/javascript">
var sheetPublicWebUrl = ""
var req = new XMLHttpRequest();'GET', sheetPublicWebUrl, true);
req.onload = function() {
result = req.responseText;