Skip to content

Instantly share code, notes, and snippets.

docker_compose_exec() {
docker exec -it $(docker-compose ps | grep $1 | awk '{print $1}') ${@:2}
}
alias dcrun='docker_compose_exec web'
alias dcenter='docker_compose_exec web bash'
alias dcenter_new='docker-compose run web bash' # if container is not up
@protrolium
protrolium / ffmpeg.md
Last active May 3, 2024 18:58
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@soheilhy
soheilhy / nginxproxy.md
Last active May 8, 2024 09:56
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@wboykinm
wboykinm / index.html
Created April 2, 2014 19:02
static snapshot of active leaflet map
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Leaflet Image</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.css' rel='stylesheet' />
@jswanner
jswanner / nulls_last.rb
Created September 13, 2012 20:03
ActiveRecord Postgres Nulls Last
ActiveSupport.on_load(:active_record) do
module Arel::NullsLastPredications
def nulls_last
Arel::Nodes::NullsLast.new self
end
end
module Arel::Nodes
class NullsLast < Unary
def gsub *args
@kosmatov
kosmatov / image-preview-html5.js
Created August 13, 2012 13:46
Image file preview on HTML5/JS/jQuery
$('form').on('change', '.image_preview input[type="file"]', function(e) {
var files = e.target.files,
f = files[0],
reader = new FileReader(),
t = this
;
reader.onload = (function(file) {
@mipmip
mipmip / cli-with-options-and-arguments.rb
Created February 16, 2012 12:13
Ruby cli script with options and arguments example
#!/usr/bin/env ruby
# A script that will pretend to resize a number of images
require 'optparse'
# This hash will hold all of the options
# parsed from the command-line by
# OptionParser.
options = {}
optparse = OptionParser.new do|opts|