Skip to content

Instantly share code, notes, and snippets.

@joshuaflanagan
joshuaflanagan / meme.sh
Last active October 5, 2022 23:08 — forked from tzermias/meme.sh
Meme Generator using ImageMagick
#!/bin/bash
# meme.sh
# https://gist.github.com/joshuaflanagan/77f31411d137aec9b9c1b79b42d339f8
# Meme generator with ImageMagick
# https://www.it-cooking.com/technology/digital-image/image-processing/meme-generator-imagemagick/
usage() {
echo "Usage: $0 [ -t TOP_MSG ] [ -b BOTTOM_MSG ] [ -s FONTSIZE=80] [ -a TOP_FONTSIZE=80 ] [ -z BOTTOM_FONTSIZE=80 ] SRC DST"
@joshuaflanagan
joshuaflanagan / gist:7495006
Created November 16, 2013 02:15
Postgres extensions on Amazon RDS
name | default_version | installed_version | comment
------------------------+-----------------+-------------------+---------------------------------------------------------------------
pg_buffercache | 1.0 | | examine the shared buffer cache
earthdistance | 1.0 | | calculate great-circle distances on the surface of the Earth
pg_freespacemap | 1.0 | | examine the free space map (FSM)
intagg | 1.0 | | integer aggregator and enumerator (obsolete)
plperl | 1.0 | | PL/Perl procedural language
sslinfo | 1.0 | | information about SSL certificates
btree_gist | 1.0 | | support for indexing common datatypes in GiST
fuzzystrmatch | 1.0
SmartUrlHelper.configure do |url|
url.for ->model{ model.is_a?(Comment) } do |helpers, model|
helpers.post_comment_path(model.post, model)
end
# TODO: Add a convenience method for matching on type:
# url.for(Comment) do |helpers, model|
# helpers.post_comment_path(model.post, model)
# end
end
@joshuaflanagan
joshuaflanagan / Console command
Created June 1, 2011 22:23
Turn off Always Start When Debugging for all web projects (run within Nuget powershell console)
get-project -all | %{ $_.Properties | ?{ $_.Name -eq "WebApplication.StartWebServerOnDebug" } | %{ $_.Value = "False"} }
@joshuaflanagan
joshuaflanagan / package.bat
Created June 24, 2011 02:57
Examples of how to build all Nuget nuspec files in a folder
@ECHO OFF
SETLOCAL
SET VERSION=%1
SET NUGET=buildsupport\nuget.exe
FOR %%G IN (packaging\nuget\*.nuspec) DO (
%NUGET% pack %%G -Version %VERSION% -Symbols -o artifacts
)
@joshuaflanagan
joshuaflanagan / nuget_tool.bat
Created June 24, 2011 03:19
Example batch file to execute a tool from a Nuget package
@ECHO OFF
SETLOCAL
REM This can be used for any .exe installed by a nuget package
REM Example usage: nuget_tool.bat nunit-console.exe myproject.tests.dll
SET TOOL=%1
FOR /R %~dp0\source\packages %%G IN (%TOOL%) DO (
IF EXIST %%G (
SET TOOLPATH=%%G
GOTO FOUND
)
@joshuaflanagan
joshuaflanagan / fish.rb
Last active January 13, 2016 23:50
Simplify working with UUID primary keys in Rails console
class ActiveRecord::Base
# Find a record by UUID primary key prefix
#
# Example:
# > User.fish "1245"
# # User Load (0.3ms) SELECT "users".* FROM "users" WHERE ("users"."id" BETWEEN '12450000000000000000000000000000' AND '1245ffffffffffffffffffffffffffff') LIMIT $1 [["LIMIT", 2]]
# => #<User id: "12451304-761d-4e1d-8281-40aa6213b633", name: "josh">
def self.fish(partial_id)
return find(partial_id) unless partial_id.is_a?(String)
scrubbed = partial_id.gsub(/[^a-fA-F0-9]/, "")
@joshuaflanagan
joshuaflanagan / pull_request_labels.user.js
Created February 2, 2013 19:53
UserScript to show Labels on Pull Requests
// ==UserScript==
// @name Pull Request Labels
// @namespace http://joshuaflanagan.com
// @include https://github.com/*/*/pulls
// @version 1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// ==/UserScript==
$(function(){
var $pull_requests = $(".pulls-list .list-browser-item h3");
$pull_requests.each(function(){
@joshuaflanagan
joshuaflanagan / publish_nuget.rb
Created June 24, 2011 03:07
Example rake task that downloads CI artifacts to publish nuget packages to the official feed
desc "Downloads from CI and pushes nuget packages to the official feed"
task :release, [:package] do |t, args|
require 'open-uri'
release_path = "#{buildsupport_path}/nuget_release"
clean_dir release_path
# The @teamcity_build_id is a unique identifier for the build configuration (looks like "bt234"). You can usually figure it out from your project url
artifact_url = "http://teamcity.codebetter.com/guestAuth/repository/downloadAll/#{@teamcity_build_id}/.lastSuccessful/artifacts.zip"
puts "downloading artifacts from teamcity.codebetter.com"
artifact = open(artifact_url)
using System;
using StructureMap;
namespace ConsoleApplication1
{
class Program {
private static void Main(string[] args) {
IContainer container = ConfigureDependencies();
IAppEngine appEngine = container.GetInstance<IAppEngine>();