Skip to content

Instantly share code, notes, and snippets.

@abn
abn / heredoc-dockerfile.snip
Last active July 31, 2024 06:26
Dockerfile alternatives for heredoc
#printf
RUN printf '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
>> /tmp/hello
#echo
RUN echo -e '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
@paulRbr
paulRbr / logstash.conf
Last active January 17, 2022 04:22 — forked from mudge/logstash.conf
Logstash configuration to parse Rails logs in a multi-process environment. Assume your logs are prepend by logtags as seen in the RLOGTAGS pattern.
input {
file {
type => "rails"
path => "/log/development.log"
tags => ["development"]
}
}
filter {
if [type] == "rails" {
@joerixaop
joerixaop / README.md
Last active August 29, 2015 14:10 — forked from botandrose/README.md
@eoinkelly
eoinkelly / postgres-upgrade-recipe.sh
Last active November 9, 2017 16:59
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
@shawn42
shawn42 / gamebox_fade.rb
Created January 3, 2015 23:05
fading text in gamebox
define_behavior :fades do
requires :director
setup do # |opts|
fade_out_time = 3_000
actor.has_attributes total_fade_time: fade_out_time, fade_time: fade_out_time
director.when :update do |time_ms, secs|
actor.fade_time -= time_ms
alpha = 255 * actor.fade_time / actor.total_fade_time
actor.remove if actor.fade_time <= 0
@shawn42
shawn42 / demo_stage.rb
Created January 6, 2015 02:14
tween usage in gamebox
define_stage :demo do
requires :tween_manager
curtain_up do
@player = spawn :player, x: 10, y:30
tween = tween_manager.tween_properties @player, {x: 600, y:750}, 6_000, Tween::Sine::InOut
# tweens can be canceled if need be, or they will clean themselves up when finished
timer_manager.add_timer :foo, 3_000, false do
tween.cancel!
end
@squarism
squarism / swagger.md
Created January 23, 2015 23:00
Swagger Grape Weirdness

Imma turn this into a blog post soon but in the meantime wanted to give the Google index a hit on

  cannot load such file -- grape-swagger

The grape-swagger gem is forked right now (2015-01-23). If you simply follow the docs, you're going to get a require error.

In Gemfile, change gem "grape-swagger-rails" to this: gem "grape-swagger-rails", github: "BrandyMint/grape-swagger-rails"

@santiaago
santiaago / main.go
Created February 10, 2015 19:20
Testing HTTP caching in Go
package main
import (
"bytes"
"flag"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"
@tlehman
tlehman / boolfail.py
Created September 21, 2015 23:11
Redefine true and false in python
# Python boolean fail
# Or how to redefine True and False and win any argument on the internet!
# Love, @tlehman
from unittest import TestCase
class BoolFail(TestCase):
def test_false(self):
True = False
assert True == False