Skip to content

Instantly share code, notes, and snippets.

View stevecrozz's full-sized avatar

Stephen Crosby stevecrozz

View GitHub Profile
# Liquid tag for rendering Rouge CSS
#
# Usage:
# {% rouge_css <theme> [mode] %}
#
# Examples:
# {% rouge_css github %}
# {% rouge_css base16 light %}
class RougeCss < Liquid::Tag
def initialize(tag_name, args, tokens)
# clone into the appropriate place in your $GOPATH
git clone git@gist.github.com:63cb64e5217beab99342e4b0aea9551f.git

# change into the buggy project
cd 63cb64e5217beab99342e4b0aea9551f

# generate a client package
"$GOPATH/bin/goagen" -o . -d gist.github.com/63cb64e5217beab99342e4b0aea9551f client
recent = !git for-each-ref refs/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset)|%(color:bold green)%(committerdate:relative)%(color:reset)|%(contents:lines=1)|%(color:magenta)%(authorname)%(color:reset)' --count 100 --sort=-committerdate | column -ts '|' | less -SXRF
@stevecrozz
stevecrozz / drone-io-aws-cloudwatch-metrics-producer.py
Created March 22, 2018 23:54
drone.io AWS CloudWatch metrics producer
#! /usr/bin/env python
import json, sys, urllib2
from subprocess import call
request_headers = {
"Authorization": "Bearer ..."
}
request = urllib2.Request("https://.../api/info/queue", headers=request_headers)
@stevecrozz
stevecrozz / Dockerfile.kramdown-minified
Created January 4, 2019 06:27
Dockerfile.kramdown-original
FROM ruby:2.6-alpine
RUN gem install kramdown && \
rm -R /usr/local/bundle/gems/kramdown-1.17.0/test/ && \
rm -R /usr/local/bundle/gems/kramdown-1.17.0/doc/ && \
rm -R /usr/local/bundle/cache/
@stevecrozz
stevecrozz / doit.rb
Created February 1, 2019 21:58
autogenerate mobx-state-tree models from ruby mongoid models
def doit
type_map = {
BSON::ObjectId => 'string',
Time => 'date',
Object => 'reference',
Hash => 'map',
Integer => 'integer',
DateTime => 'Date',
String => 'string',
Array => 'array',
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck
# License: BSD 3 clause
from __future__ import print_function
import re
import logging
@stevecrozz
stevecrozz / read-rails-session.js
Last active March 9, 2019 04:49
read rails 5.1 sessions from nodejs
const crypto = require('crypto');
const rawCookie = 'raw-cookie-contents';
class SessionReader {
constructor({
secret_key_base,
salt,
iterations,
keylen,
@stevecrozz
stevecrozz / r-png.rb
Created February 23, 2021 23:24
Ruby PNG Reader
require 'zlib'
module RImage
class InvalidSignature < Exception
end
class InvalidChecksum < Exception
end
class RImage
@stevecrozz
stevecrozz / mullvad-config-to-edgerouter-config.sh
Created July 29, 2024 16:04
Process mullvad ini config into some edgerouter config
#! /bin/bash
private_key=$(grep PrivateKey "$1" | cut -d ' ' -f 3 | awk '{$1=$1;print}')
public_key=$(grep PublicKey "$1" | cut -d ' ' -f 3 | awk '{$1=$1;print}')
allowed_ips=$(grep AllowedIPs "$1" | cut -d ' ' -f 3 | awk '{$1=$1;print}')
address=$(grep Address "$1" | cut -d ' ' -f 3 | awk '{$1=$1;print}')
endpoint=$(grep Endpoint "$1" | cut -d ' ' -f 3 | awk '{$1=$1;print}')
echo $private_key
echo $public_key