Skip to content

Instantly share code, notes, and snippets.


cenan ozen cenan

View GitHub Profile
jordic / ssh.go
Created May 27, 2014 14:03
golang mysql throught a tunnel
View ssh.go
package main
// based on gist
// obro conexio ssh amb el server remot.
// tot el que envio al port local ho copio al port remote
// a traves de la conexio remota. Per tant he d'obrir un
// port a la maquina remota?
jonmorehouse / tar.go
Created February 17, 2014 22:29
Quick golang script for creating a gzipped tarball
View tar.go
package main
import (
AhmedElSharkasy / best_practices
Last active April 8, 2019 14:53
Rails 3 AntiPatterns, Useful snippets and Recommended Refactoring. Note: Some of them are collected from different online resources/posts/blogs with some tweaks.
View best_practices
Rails as it has never been before :)
Rails 3 AntiPatterns, Useful snippets and Recommended Refactoring.
Note: Some of them are collected from different online resources/posts/blogs with some tweaks.
View inline-css-font.rb
#!/usr/bin/env ruby
require 'base64'
require 'open-uri'
# file or url
def get_css(src)
if src.start_with? 'http'
src = src.gsub('|', '%7C')
STDERR.puts "# GET #{src}"
# simulate modern browser to get woff
jbonney / deploy.rb
Created August 17, 2013 15:15
Mina deployment file to setup new host for Rails applications. Creates the folder structure, fill up the database.yml file, create the associated DB and user and set up new Apache virtual host file.
View deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
# Usually mina focuses on deploying to one host and the deploy options are therefore simple.
# In our case, there is a number of possible servers to deploy to, it is therefore necessary to
# specify the host that we are targeting.
server = ENV['server']
# Since the same host can have multiple applications running in parallel, it is necessary to
bondario / ubuntu1204_php54
Created August 9, 2013 15:54
Downgrade php 5.5 to 5.4 or keep php 5.4 for Ubuntu 12.04.02 LTS
View ubuntu1204_php54
apt-get install -y ppa-purge
add-apt-repository -y ppa:ondrej/php5-oldstable
apt-get update
ppa-purge ppa:ondrej/php5
apt-get update && apt-get upgrade -y && apt-get autoremove -y && apt-get autoclean -y
ingdir / gist:0b211b9253c376f9cfa5
Last active January 23, 2023 15:58
BEM Cheatsheet
View gist:0b211b9253c376f9cfa5

BEM Cheatsheet


Block encapsulates a standalone entity that is meaningful on its own.

While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Holistic entities without DOM representation (such as controllers or models) can be blocks as well.

kei2100 / ImageMagick and JMagick install on Mac OSX
Last active November 6, 2019 15:40
ImageMagick and JMagick install on Mac OSX
View ImageMagick and JMagick install on Mac OSX
# imagemagick
brew install imagemagick --disable-openmp
sudo brew link libtiff
sudo brew link little-cms
sudo brew link jasper
sudo brew link imagemagick
sudo brew link jpeg
rayfranco / GravatarExtension.php
Last active November 6, 2018 05:30
Twig extension filter that convert email into gravatar url, or secure gravatar url
View GravatarExtension.php
// Acme\DemoBundle\Twig\GravatarExtension
namespace Acme\DemoBundle\Twig;
class GravatarExtension extends \Twig_Extension
private $secure_request = false;
errordeveloper /
Last active February 9, 2022 09:21
Upstart config for a Rails app using Unicorn HTTP server

Using Unicorn with Upstart

This configuration works with Upstart on Ubuntu 12.04 LTS

The reason why it needs to be done this way (i.e. with the pre-start and post-stop stanzas), is because Upstart is unable to track whever Unicorn master process re-execs itself on hot deploys. One can use it without hot-deploys and run Unicorn in foreground also, it then only needs one exec stanza.

This presumes you are not using RVM, so no voodoo dances.