Skip to content

Instantly share code, notes, and snippets.

@jnunemaker
jnunemaker / gist:217362
Created October 24, 2009 04:07 — forked from lukesutton/gist:107966
example of warden with sinatra
Warden::Manager.serialize_into_session{|user| user.id }
Warden::Manager.serialize_from_session{|id| User.get(id) }
Warden::Manager.before_failure do |env,opts|
# Sinatra is very sensitive to the request method
# since authentication could fail on any type of method, we need
# to set it for the failure app so it is routed to the correct block
env['REQUEST_METHOD'] = "POST"
end
@rubiojr
rubiojr / rbvmomi_example1.rb
Created September 5, 2011 15:28
Ruby VMWare VSphere API Example 1 (rbvmomi)
require 'rubygems'
require 'rbvmomi'
require 'pp'
require 'alchemist'
hyper = 'thunder03'
vim = RbVmomi::VIM.connect :host => hyper, :user => 'root', :password => 'secret', :insecure => true
#
# get current time
@slayer
slayer / rbenv-install-system-wide.sh
Created December 23, 2011 11:17
rbenv install and system wide install on Ubuntu to /opt/rbenv
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /opt/rbenv
# Add rbenv to the path:
@marcoleong
marcoleong / bootstrap-scrollspy-horizontal.js
Created February 27, 2012 09:22
Modified bootstrap-scrollspy.js to support horizontal scroll.
/* =============================================================
* bootstrap-scrollspy.js v2.0.1
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@me-vlad
me-vlad / thin.sh
Created March 18, 2012 03:41
init script for multiple thin instances with rbenv shared install
#!/bin/sh
# thin This shell script takes care of starting and stopping
# thin daemon from rbenv shared install
#
# chkconfig: 2345 85 15
# description: thin is an Ruby web server
# config: /etc/sysconfig/thin
### BEGIN INIT INFO
@nidico
nidico / issue-migrate-bitbucket-to-github.py
Created September 24, 2012 21:00
Helper script for issue migration from Bitbucket to GitHub
#!/usr/bin/env python
"""
This script helps migrating issues from Bitbucket to GitHub.
It currently ignores milestones completly and doesn't care whether an issue is
open, new or on hold. As long as it's not closed it's considered open.
To use it, install python-bitbucket, PyGithub and ipdb.
@josegonzalez
josegonzalez / access.lua
Created December 3, 2012 18:26
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
ngx.exit(403)
end
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
@shtirlic
shtirlic / gist:5052306
Last active November 18, 2021 17:58 — forked from joelmoss/gist:2470666
set :stage, 'production'
set :shared_children, shared_children << 'tmp/sockets'
puma_sock = "unix://#{shared_path}/sockets/puma.sock"
puma_control = "unix://#{shared_path}/sockets/pumactl.sock"
puma_state = "#{shared_path}/sockets/puma.state"
puma_log = "#{shared_path}/log/puma-#{stage}.log"
namespace :deploy do
desc "Start the application"
@runlevel5
runlevel5 / puma.sh
Last active July 18, 2022 17:37
pumactl is very broken, @nemshilov and @joneslee85 wrote this bash script replacement and it works so reliably on production server. So here it is, share with the world!
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
@absoutherland-zz
absoutherland-zz / dashboard
Created November 19, 2013 23:00
init script for Dashing
#!/bin/bash
# chkconfig: 2345 55 25
# Dashing service
# Add this file to /etc/init.d/
# Make executable
# Configure chkconfig
# Dashboard will start at boot. Check out the boot log for trouble shooting "/var/log/boot.log"
######################################################
#YOU WILL NEED TO CONFIGURE THIS FOR YOUR ENVIRONMENT#
######################################################