Skip to content

Instantly share code, notes, and snippets.

vladshub /
Last active Jul 31, 2018
nginx auth_request doesn't post :(
while true ; do echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -l -p 1501 ; done
shock / heredoc.rb
Created Jul 21, 2016
String object extensions for handling proper indentation duration HEREDOC interpolation of multi-line strings.
View heredoc.rb
# Created in response to Stack Overflow question:
module CoreExtensions
module String
module Heredoc
# Special character to flag lines that are part of a multiline HEREDOC interpolation
# Any character that is not part of the output string will work. Using "\r" because
# it's rarely used in hard-coded strings.
brianpetro / rails-4-new-options
Created Apr 28, 2015
Command line options for ` rails new --help ` (Rails 4.2). Useful for planning new Ruby on Rails app. 'Where can I find options for “rails new” command?'
View rails-4-new-options
Because I couldn't find these with a quick Google search on 28 April 2015:
rails new APP_PATH [options]
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /home/brian/.rvm/rubies/ruby-2.2.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
ohryan / responsive-align.less
Last active Apr 30, 2019
Bootstrap 3 Responsive Text Align
View responsive-align.less
.text-xs-left { text-align: left; }
.text-xs-right { text-align: right; }
.text-xs-center { text-align: center; }
.text-xs-justify { text-align: justify; }
@media (min-width: @screen-sm-min) {
.text-sm-left { text-align: left; }
.text-sm-right { text-align: right; }
.text-sm-center { text-align: center; }
.text-sm-justify { text-align: justify; }
jose8a / Convert MARKDOWN files to HTML
Last active Apr 11, 2020
Converting a folder full of markdown files, each linking to each other ... convert those files to HTML, and convert the relative links to point to the new html files. Add code highlighting with highlight.js . Finally serve up the result as a static web site.
View Convert MARKDOWN files to HTML
Converting md files to html w/highlighting
0a) Create a root directory to pull in all the repos
0b) Recursively clone or pull each repo
$> git clone <repo_url> | git pull on the existing repos
0c) Create a TOC index.html file for the root folder
$> echo '<head>' >> index.html
$> echo '' >> index.html
$> echo '</head>' >> index.html
$> echo '<body>' >> index.html
$> ls >> temp.html
jgornick / configure-make-make-install.yaml
Last active May 19, 2020
Ansible: ./configure, make, make install
View configure-make-make-install.yaml
# This works
- name: Install unixODBC
command: sudo {{ item }} chdir="/tmp/{{ mysql_odbc_unixodbc_url | basename | replace('.tar.gz', '') }}"
- ./configure --prefix=/usr/local
- make
- make install
# This _doesn't_ work
# Why doesn't the chdir option get recognized?
allaire / upload_erb.rb
Last active Mar 28, 2018
Capistrano 3 upload file from erb template
View upload_erb.rb
def template(from, to, options = {})
template_path = File.expand_path("../../templates/#{from}", __FILE__)
template =
upload!, to, mode: 0644 # Otherwise it's set to 0640, which is not readable by other users (
sudo "chown root:root #{to}" if options[:as_root]
matthiasg / docs style (bootstrap)
Created Aug 5, 2013
the callouts from the bootstrap documentation
View docs style (bootstrap)
/* Side notes for calling out things
-------------------------------------------------- */
/* Base styles (regardless of theme) */
.bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;
willurd /
Last active Sep 19, 2020
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
jimothyGator /
Last active Sep 17, 2020
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
You can’t perform that action at this time.