Skip to content

Instantly share code, notes, and snippets.

Nikolay Rozhkov nirname

Block or report user

Report or block nirname

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vladshub
vladshub / nc_api.sh
Last active Jul 31, 2018
nginx auth_request doesn't post :(
View nc_api.sh
#!/bin/bash
while true ; do echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -l -p 1501 ; done
@shock
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:
# http://stackoverflow.com/questions/38504004/interpolate-multiline-string-with-correct-indent
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
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:
Usage:
rails new APP_PATH [options]
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
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
jose8a / Convert MARKDOWN files to HTML
Last active May 17, 2019
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
jgornick / configure-make-make-install.yaml
Last active May 9, 2018
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', '') }}"
with_items:
- ./configure --prefix=/usr/local
- make
- make install
# This _doesn't_ work
# Why doesn't the chdir option get recognized?
@allaire
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 = ERB.new(File.new(template_path).read).result(binding)
upload! StringIO.new(template), to, mode: 0644 # Otherwise it's set to 0640, which is not readable by other users (https://github.com/net-ssh/net-scp/blob/master/lib/net/scp/upload.rb#L63)
sudo "chown root:root #{to}" if options[:as_root]
end
@matthiasg
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
willurd / web-servers.md
Last active Nov 11, 2019
Big list of http static server one-liners
View web-servers.md

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
jimothyGator / README.md
Last active Nov 1, 2019
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
View README.md
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.