Skip to content

Instantly share code, notes, and snippets.

View mfrederickson's full-sized avatar

Marvin Frederickson mfrederickson

View GitHub Profile
@mfrederickson
mfrederickson / example.rb
Created March 27, 2019 18:22
vanco nvp encrypt/decrypt in ruby aes256-ecb
# encrypt example in ruby
require 'base64'
require 'openssl'
require 'zlib'
key = 'ContactVancoForYourEncryptionKey'
plaintext = 'requesttype=efttransparentredirect&requestid=554433&clientid=ES12345&urltoredirect=http://www.testurl__.com'
deflated = Zlib::Deflate.new(nil, -Zlib::MAX_WBITS).deflate(plaintext, Zlib::FINISH)
padding_needed = 16 - (deflated.length % 16)
padded = deflated + (padding_needed == 16 ? '' : ' ' * padding_needed)
@mfrederickson
mfrederickson / end.gcode
Last active January 10, 2024 12:07
anet a8 start/end gcode
M104 S0 ; turn off extruder
M140 S0 ; turn off heatbed
M107 ; turn off fan
G91 ; relative positioning
G1 Z25 ; raise head 25mm
G90 ; back to absolute positioning
G1 X0 Y220; home X axis and push Y forward
M84 ; disable motors
@mfrederickson
mfrederickson / Gemfile
Created January 26, 2018 19:48 — forked from kuboon/Gemfile
acts_as_taggable_on + simple_form + select2
gem 'acts-as-taggable-on'
gem 'simple_form'
gem 'select2-rails'
# As root user, install the packages we need
apt-get install build-essential libmagickwand-dev libmysqlclient-dev libpq-dev libv8 libxslt-dev mysql-server mysql-client git curl apache2
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger jessie main > /etc/apt/sources.list.d/passenger.list'
apt-get update
apt-get install -y apt-transport-https ca-certificates libapache2-mod-passenger
a2enmod passenger
apache2ctl restart
# install rvm
@mfrederickson
mfrederickson / install-redis.sh
Last active July 25, 2016 23:28 — forked from four43/install-redis.sh
Install Redis
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/four43/e00d01ca084c5972f229/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@mfrederickson
mfrederickson / cups-pdf-renamer
Created June 6, 2015 16:42
/usr/local/bin/cups-pdf-renamer
#!/bin/bash
# http://ubuntuportal.com/2012/04/easy-way-to-create-pdf-printer-in-ubuntu-12-04.html (install cups-pdf)
# http://ubuntuforums.org/showthread.php?t=799056 (how to config)
FILENAME=`basename $1`
DIRNAME=`dirname $1`
DATE=`date +"%Y-%m-%d_%H:%M:%S"`
mv $1 "${DIRNAME}/${DATE}.pdf"
@mfrederickson
mfrederickson / gist:5717cd1d463340e02555
Created March 20, 2015 19:35
install rjb on digitalocean droplet with rvm giving JAVA_HOME undefined -- resolved
I had to change the rvmsudo script (around line 82 where it filters out environment variables) to allow JAVA_HOME through by adding it to the end of the list.
@mfrederickson
mfrederickson / installing_concerto_shared_hosted_environment.md
Created February 28, 2014 18:16
How to install concerto 0.8.7 in a shared hosted environment such as hostmonster.com

As August mentioned in one of his group postings concerto is really intended to be installed on a server where you have root access so you can affect changes to OS level files (services, gems, etc.) However, I was able to get it working on a hostmonster.com basic, shared hosting account by doing the following. The only drawback is that you'll need something in the cron to check and make sure the "services" are running and if not, restart them.

ssh into your account. Get the concerto code and put it under rails_apps/concerto. Add directories for log and tmp. This grabs the master branch, you might want to switch to the latest release once you git clone it.

mkdir rails_apps
cd rails_apps
git clone https://github.com/concerto/concerto
cd concerto
mkdir log
mkdir tmp
@mfrederickson
mfrederickson / database.postgresql.yml
Created August 26, 2013 02:05
concerto2 postgresql config sample
development:
adapter: postgresql
encoding: unicode
database: concerto_development
username: concerto
password: concerto
host: localhost
pool: 5
timeout: 5000
@mfrederickson
mfrederickson / prepvm_for_capistrano
Last active December 21, 2015 03:59
Script to prepare default concerto vm image for capistrano deploys.
#!/bin/bash
# prepvm_for_capistrano
# Prepares the concerto virtual machine image for capistrano deploys.
# Download this script to the concerto home directory, chmod +x it and
# run as sudo (for directory creation and permission and config changes).
#
# if it complains about not having an /etc/init.d/concerto service script
# the you probably have an older vm image and can safely skip that check
# by running "sudo ./prepvm_for_capistrano skip"