Skip to content

Instantly share code, notes, and snippets.

View azisaka's full-sized avatar

Zisa azisaka

View GitHub Profile
@carlosantoniodasilva
carlosantoniodasilva / gist:906129
Created April 6, 2011 17:49
Running Capybara + Webdriver with Xvfb in a CI server (linux)
## rake command
RAILS_ENV=test DISPLAY=:2.0 rake db:migrate spec:acceptance
## init.d
#!/bin/sh
### BEGIN INIT INFO
# Provides: xvfb
@dvdplm
dvdplm / mock_tire.rb
Created March 27, 2012 11:06
Mocking helper to stop Tire from submitting searches to Elasticsearch
module Tire
module Disable
module ClassMethods
def mock_es_response_doc
@mock_es_response_doc ||=
'{"took": 1,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed": 0},"hits": {"total": 0,"max_score": null,"hits": []}}'
end
def enable! &blk
old_enabled = @tire_enabled || false
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 15, 2024 09:51
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tansengming
tansengming / configure.rb
Created July 9, 2012 07:37
Ruby configure blocks
# How Clearance / Hoptoad does it
module Clearance
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield(configuration)
end
@scottatron
scottatron / README.md
Created August 11, 2012 04:17
Lossless compression of images in Rails using Dragonfly & image_optim

This runs provides an .optim job for dragonfly and also adds the .optim job into .thumb

This requires you have the 'image_optim' gem and it's dependencies.

@adrienbrault
adrienbrault / purge.sh
Created September 24, 2012 10:02
Script to reduce VM size before packaging for vagrant
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@ssp
ssp / emf-converter.sh
Created November 13, 2012 14:54
Convert Windows EMF to usable graphics files with a crazy chain of tools.
#! /bin/sh
# Convert Windows EMF to usable graphics files with a crazy chain of tools.
# 2012 Sven-S. Porst, SUB Göttingen <[email protected]>
# Configuration
BASEPATH=/Users/ssp/SUB/edfu/emf
WINE=wine
METAFILE2EPS=$BASEPATH/metafile2eps-linux/metafile2eps.exe
PS2PDF=ps2pdf
INKSCAPE=/Applications/Graphik/Inkscape.app/Contents/Resources/bin/inkscape
require 'nokogiri'
RSpec::Matchers.define :have_xml do |xpath, text|
match do |body|
doc = Nokogiri::XML::Document.parse(body)
nodes = doc.xpath(xpath)
nodes.empty?.should be_false
if text
nodes.each do |node|
node.content.should == text
end
@reifman
reifman / default.vcl
Last active September 9, 2021 08:15
Example Varnish VCL Configuration e.g. /etc/varnish/default.vcl
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 60s;
.first_byte_timeout = 60s;
.between_bytes_timeout = 60s;
.max_connections = 800;
}
@mergulhao
mergulhao / gist:6269789
Last active April 6, 2017 13:33
How to convert a PFX ssl certificate to PEM? If you are in Brazil and buy an A1 (e-CNPJ) certificate from CertSign it comes as a PFX. We need to convert it to PEM format so we can use the certificate to sign documents electronically and use it to access a lot of APIs, incluing NFe.
### pfx to pem, complete edition:
$ openssl pkcs12 -in filename.pfx -nocerts -out key.pem
$ openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem
$ openssl pkcs12 -in filename.pfx -cacerts -out ca_cert.pem