Skip to content

Instantly share code, notes, and snippets.

@bjeanes
bjeanes / AAA_uuid_generate_v6mc.sql
Last active July 22, 2022 00:27
Postgres UUIDv6 (non-standard)
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- My port of https://github.com/kurttheviking/uuid-with-v6-js
-- A hacky translation of:
-- - http://gh.peabody.io/uuidv6/
-- - https://tools.ietf.org/html/draft-peabody-dispatch-new-uuid-format
CREATE OR REPLACE FUNCTION uuid_v1_to_v6(v1 uuid)
RETURNS uuid AS $$
DECLARE
v6 text;
@toolmantim
toolmantim / socket_stats_logger
Created June 16, 2015 07:18
How to monitor Unicorn and Puma unix socket queues with statsd
#!/bin/bash
# Logs the queued and active stats from the application's sockets and posts to statsd
while true; do
proc_lines=`cat /proc/net/unix`
for file in /home/deploy/myapp/tmp/sockets/*.sock; do
# /proc/net/unix lines are of the format:
@stuart-warren
stuart-warren / hubot-wizard.coffee
Created June 10, 2015 19:39
Hubot Conversation
#
# Description:
# Have a multi-step conversation with hubot
#
# Commands:
# hubot start wizard - Allow hubot to ask you some questions
#
module.exports = (robot) ->
@schneems
schneems / gist:e09c95da37a8c50047a8
Created May 12, 2015 18:23
Find 50 most popular Gems that have mime-types as a dependency
require 'net/http'
require 'json'
def rubygems_get(gem_name: "", endpoint: "")
path = File.join("/api/v1/gems/", gem_name, endpoint).chomp("/") + ".json"
JSON.parse(Net::HTTP.get("rubygems.org", path))
end
results = rubygems_get(gem_name: "mime-types", endpoint: "reverse_dependencies")
@mrmagooey
mrmagooey / main.py
Last active November 4, 2020 21:52
BoM radar gif
#!/usr/bin/env python
# MIT Licence
# Gets radar overlays from the Australian Bureau of Meteorology radar pages
# and creates an animated gif out of it.
# Needs requests and pillow (the python packages) and ImageMagick the standalone graphics
# program to be installed and available to work.
# All radar images are copyright BoM, and this script should not be used for
# commercial purposes, or possibly at all.
@nickbrowne
nickbrowne / mint17mba.md
Last active May 18, 2016 02:06
Mint 17 on 2013 Macbook Air

Backlight

Install https://github.com/patjak/mba6x_bl

Add xorg config (/usr/share/X11/xorg.conf.d/20-intel.conf):

Section "Device"
        Identifier  "Intel Graphics"
        Driver      "intel"
 Option "Backlight" "mba6x_backlight"
@Odaeus
Odaeus / application_controller.rb
Last active October 11, 2019 23:55
Simple Presenter Pattern
class ApplicationController < ActionController::Base
# ...
concerning :Presenters do
included do
helper_method :present
end
def present(record_or_array, klass)
if record_or_array.respond_to?(:map)
@kenoir
kenoir / dynamo_db_query_example.md
Last active June 19, 2018 21:27
Prettied up some AWS Ruby SDK DynamoDB examples from @Integralist.

AWS query-instance_method docs

export AWS_ACCESS_KEY_ID=‘XXXX’
export AWS_SECRET_ACCESS_KEY=‘XXXX’
# ENV['AWS_ACCESS_KEY_ID']
# ENV['AWS_SECRET_ACCESS_KEY']
@taybenlor
taybenlor / Form Letter.md
Last active April 23, 2017 08:35
Form letter that I email to companies offering unpaid internships.

Subject: Unpaid Internships & Fair Work

Hi there,

I'm Ben Taylor, I don't represent anyone or anything, I'm simply a concerned Australian. Our country has long been known as a paradise for the working class. We give fair holidays and fair pay. We're a country that doesn't tip because we know the waitstaff are earning enough to support themselves.

I'm emailing you because your company is offering an unpaid internship. Under Australian law it's illegal to have an employee that works for free. In many cases unpaid internships are illegal.

It's absolutely in your right to offer an internship, you can pay them minimum wage if you like, but not paying is exploitative and discriminatory. Should a young person who is independent be forced to take a second job or live under severe financial stress just to get a chance in an industry? What about those who can't afford to do even that?

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results