Skip to content

Instantly share code, notes, and snippets.

charge = Stripe::Charge.create({
amount: @order.total_in_cents,
card: @order.stripe_card_token,
currency: "usd",
description: "Org: #{@org.name}, Plan: #{@plan.name}",
application_fee: @order.total_in_cents.percent_of(@org.percent_amount)
}, @org.stripe_oauth_token)
@order.stripe_charge_identifier = charge.id
@iDiogenes
iDiogenes / gist:3231039
Created August 1, 2012 21:49
RADIUS with MySQL Support
Ubuntu MySQL & RADIUS Howto:
Install MySQL
# apt-get install mysql-server mysql-client
Secure MySQL
Mysql_secure_installation
###########################################################################
# $Id$ #
# #
# schema.sql rlm_sql - FreeRADIUS SQL Module #
# #
# Database schema for MySQL rlm_sql module #
# #
# To load: #
# mysql -uroot -prootpass radius < schema.sql #
# #
#!/usr/bin/env ruby
# Daemon script for running ifs_notify
# The script can start, stop and check status of ifs_notify
pwd = Dir.getwd
file = pwd + "/ifs_notify"
pidfile = "../var/ifs_notify.pid"
# Starting ifs_notify
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), *%w[ ../lib])
require 'ifs_notify'
require 'sequel'
# method for converting isilon string to int
def quota_compare(size)
prefix = size.slice(/[GMTK]/) # remove the letter value for later use
@iDiogenes
iDiogenes / gist:702051
Created November 16, 2010 16:47
daemon
#!/usr/bin/env ruby
# Daemon script for running ifs_notify
# The script can start, stop and check status of ifs_notify
pwd = Dir.getwd
file = pwd + "/ifs_notify"
pidfile = "../var/ifs_notify.pid"
# Starting ifs_notify
ldap = IfsNotify::LoniLDAP.new(h["username"]),
h = {
:gname => ldap.ldap_firstname,
:name => ldap.ldap_username,
:mail => ldap.ldap_mail
}
#!/usr/bin/env ruby
require "rubygems"
require "sequel"
# connect to an in-memory database
DB = Sequel.sqlite('../var/ifs_notify.db')
# create users table
DB.run("create table users(username varchar(8) primary key, directory varchar(100), emailaddr varchar(30), lstemail varchar(33));")
f = File.open('/ifshome/.quota', "r") # Generated from ifs-10 cronjob
lines = f.readlines.select
lines.delete_at(0)
sleep 1
lines.each do |u|
u = u.split(' ')
puts u
sleep 1
home = u[1]
qs = u[4]
@quotasize = 4G
storage = @quotasize.slice!(/GMT/)
quota_thres = sprintf('%0.2f',(@quotasize.to_f/((1+0.10))))
puts storage
puts quota_thres