Skip to content

Instantly share code, notes, and snippets.

@csexton
csexton / znc.conf
Created Sep 23, 2012
Example ZNC Config
View znc.conf
// WARNING
//
// Do NOT edit this file while ZNC is running!
// Use webadmin or *admin instead.
//
// Buf if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.
// Also check http://en.znc.in/wiki/Configuration
AnonIPLimit = 10
MaxBufferSize= 500
View encryptable.rb
# frozen_string_literal: true
module Encryptable
ENCRYPTABLE_SALT = "iris.encryptable_salt"
def encrypt(string)
crypt.encrypt_and_sign(string)
end
def decrypt(encrypted_data)
@csexton
csexton / openssl.cnf
Created Nov 7, 2016
Multi-Domain CSR Config for OpenSSL with Wildcards
View openssl.cnf
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
@csexton
csexton / post-sqs.rb
Created Jul 16, 2013
Simple ruby script to post to SQS
View post-sqs.rb
#!/usr/bin/env ruby
# This require the 'aws-sdk' gem to be installed
require 'aws/sqs'
require 'json'
ENV['AWS_ACCESS_KEY_ID']="XXX"
ENV['AWS_SECRET_ACCESS_KEY']="XXX"
ENV['AWS_SQS_QUEUE']="https://sqs.us-east-1.amazonaws.com/XXX/queue-name"
body = { "string" => "data", "array" => [1,2,3] }
View heroku.log
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.5.3
-----> Installing dependencies using bundler 2.0.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Using rake 12.3.3
Using concurrent-ruby 1.1.5
Using i18n 1.6.0
Using minitest 5.11.3
Using thread_safe 0.3.6
@csexton
csexton / mov2gif.rb
Created Jul 3, 2019
Simple script to convert a mov file to an animated gif. Requires ffmpeg.
View mov2gif.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
options = {
rate: 30,
log: 0,
}
@csexton
csexton / ip_address.rb
Created Apr 18, 2012
Store the IP Addresses as integers in MongoDB
View ip_address.rb
module MongoidTypes
#
# Store the IP Addresses as integers in MongoDB.
#
# The documents would look something like this in mongo
#
# { "_id" : ObjectId("4f8e2ea261455b704d000001"), "ip_address" : NumberLong("3232235777") }
#
# To have your model use this class simply set the type for the feild in mongoid
#
@csexton
csexton / neopixel.cc
Created Jun 27, 2019
Simple Neopixel with serial command control
View neopixel.cc
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
@csexton
csexton / main.go
Created Jun 27, 2019
Get the USB Serial Number from C in Go with IOKit
View main.go
package main
// #cgo LDFLAGS: -framework CoreFoundation -framework IOKit
// #include <CoreFoundation/CoreFoundation.h>
// #include <IOKit/IOKitLib.h>
// #include <IOKit/serial/IOSerialKeys.h>
// #include <IOKit/usb/IOUSBLib.h>
//
// const char *
// getSerialNumber()
@csexton
csexton / local-rails.diff
Created Jun 2, 2019
Terrastories local dev mode
View local-rails.diff
diff --git a/rails/Gemfile b/rails/Gemfile
index 0262b60..61d5bd8 100644
--- a/rails/Gemfile
+++ b/rails/Gemfile
@@ -6,6 +6,7 @@ ruby '2.5.1'
gem 'rails', '~> 5.2.0'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
+gem 'sqlite3'
# Use Puma as the app server
You can’t perform that action at this time.