This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'vips' | |
images = Dir["input-*.png"].map { |file| Vips::Image.new_from_file(file) } | |
combined = Vips::Image.arrayjoin(images, across: 1) | |
buffer = combined.gifsave_buffer(page_height: images.first.height) | |
gif_image = Vips::Image.new_from_buffer(buffer, "", n: images.length) | |
gif_image = gif_image.mutate do |y| | |
y.set!("delay", images.length.times.map { 1000 }) # time is in ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Warcry Wargaming Aura Script adapted by Ziggy and Hood | |
-- Call functions | |
function revertNameDesc() | |
self.setName(og_name) | |
self.setDescription(og_desc) | |
end | |
function setWounds(value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros | |
# | |
# Optimized version which uses to_yaml for content creation and checks | |
# that models are ActiveRecord::Base models before trying to fetch | |
# them from database. | |
namespace :db do | |
namespace :fixtures do | |
desc 'Dumps all models into fixtures.' | |
task dump: :environment do | |
models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am troelskn on github. | |
* I am troelsknkarnov (https://keybase.io/troelsknkarnov) on keybase. | |
* I have a public key ASDynHl2_xhXgI0QWFmIGy8bfqZ9Ac3iEOXeJ1toyrQvzgo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am troelskn on github. | |
* I am troelsknkarnov (https://keybase.io/troelsknkarnov) on keybase. | |
* I have a public key ASCeF7wPMbEzOllgpHKzqNsMuawATDzUCu-KRCGNxk3aCgo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ARRAY_TERMINATE 0 | |
#define TRIGGER 'x' | |
#define REST '.' | |
// Will accomodate up to 64 long patterns | |
// If you want to handle larger sets, you probably need to rewrite this code | |
// to use dynamic arrays instead | |
int bjorklun_buffer[64][65]; | |
int zarray_count(int arr[]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <MIDI.h> | |
#include <HardwareSerial.h> | |
struct MIDISettings : public midi::DefaultSettings | |
{ | |
static const long BaudRate = 31250; | |
}; | |
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial1, MIDI, MIDISettings); | |
void setup() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
document = Nokogiri::XML.parse(STDIN.read) { |c| c.noent.nonet.strict } | |
xsl =<<XSL | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml" encoding="UTF-8" indent="yes" /> | |
<xsl:strip-space elements="*" /> | |
<xsl:template match="/"> | |
<xsl:copy-of select="." /> | |
</xsl:template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mojibake | |
# UTF-8 content, interpreted as latin1 | |
class Utf8 | |
CANARY = "æøåÆØÅ".chars.map { |c| c.encode(Encoding::UTF_8).force_encoding(Encoding::ISO_8859_1).encode(Encoding::UTF_8) }.freeze | |
def detect?(content) | |
CANARY.any? { |c| content.include?(c) } | |
end | |
def repair(content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmailValidation | |
SMTP_PORT = 25 | |
CONNECTION_TIMEOUT = 3 | |
READ_TIMEOUT = 3 | |
REGEX_SMTP_ERROR_BODY_PATTERN = /(?=.*550)(?=.*(user|account|customer|mailbox)).*/i.freeze | |
def initialize(verifier_domain:, verifier_email:) | |
@verifier_domain, @verifier_email = verifier_domain, verifier_email | |
end |
NewerOlder