Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View denzuko's full-sized avatar
💬
twitter.com/denzuko

Dwight Spencer (denzuko@mastodon.social) denzuko

💬
twitter.com/denzuko
View GitHub Profile
@awood
awood / README.md
Last active August 29, 2015 13:56
Auto-resolving your Docker containers

For development, I run Docker containers that start up running sshd. Then I ssh to those machines and do my development work. It works great but finding the host name to ssh into was always a chore. It usually involved something like docker inspect my_container | grep IPAddress and then copying the address. Very tedious. I'd rather just type ssh root@my_container. So I did some searching and came up with a solution similar to http://blog.oddbit.com/2013/10/04/automatic-dns-entries-for-libvirt-domains/

What we will do is have incrond create a hosts file every time a container is started or stopped. Then we will set NetworkManager to use dnsmasq and resolve names through that hosts file.

The below instructions work on Fedora 20. For other distributions, you're on your own, but the principles should be the same.

  1. Set NetworkManager to use dnsmasq by adding the following under the [main] block of /etc/NetworkManager/NetworkManager.conf

dns=dnsmasq

require 'sinatra/base'
run Sinatra.new {
get('/') do
content_type "text/plain" # you can also use Rack::ContentType
# with Sinatra except here we want
# more control since Sinatra gives it
# to us. Rack::ContentType sets the
# Content-Type on every route/url for
# the current mapping.
alias dewip="sed -E -i '' -e '/^[[:blank:]]*@wip$/d;s/,[[:blank:]]*@wip//g;s/@wip,[[:blank:]]*//g' features/**/*.feature"
#!/usr/bin/env ruby
puts "lat\tlon\ttitle\tdescription\ticon\ticonSize\ticonOffset\n"
coordinates = File.readlines "ictf-coordinates.txt"
coordinates.map! { |co| co.chomp.split(',')[1].split(';') }
organisations = File.readlines "ictf-participants.txt"
organisations.map! { |o| o.chomp }
teamnames = File.readlines "ictf-teamnames.txt"
teamnames.map! { |t| t.chomp }
@reyjrar
reyjrar / kerberos.pm
Created March 23, 2011 19:18
PacketFence authentication::kerberos
package authentication::kerberos;
=head1 NAME
authentication::kerberos - kerberos authentication
=head1 SYNOPSYS
use authentication::kerberos;
my ( $authReturn, $err ) = authenticate (
@terrancesnyder
terrancesnyder / haproxy.cfg
Created May 29, 2011 18:52
haproxy.cfg - Example HAProxy Configuration
# /etc/haproxy.cfg
global
user haproxy
group haproxy
defaults
mode http
option forwardfor
option redispatch
retries 3
@ssg
ssg / fidiz.pas
Created August 25, 2011 20:03
FIDIZ - BBS listing generator from FILE_ID.DIZ contents
{
FIDIZ! The New Generation FILE_ID.DIZ extractor...
18th Feb 1997 - 19:44 - 2.00 olayi..
}
uses Objects,Dos,Crt;
type
@gerhard
gerhard / gist:1852864
Created February 17, 2012 11:37
Deliver vs git-hooks

Why not just use git hooks?

  1. They run in the background, thus there is no visibility as to whether they succeed or fail.

  2. Deploying an app from start to finish involves multiple users, and if done right requires sudo privileges. The system user under which the app runs must not have sudo privileges, but the app itself would use Foreman ideally. If you export to Sys V or Upstart, you will need sudo privileges.

@ntreadway
ntreadway / page_inject.coffee
Created April 18, 2012 17:27
Simple page inject for JQuery Mobile and Rails Partials
# Used to dynamically add a rails page view when using Jquery Mobile
# Author Nick Treadway @nicktea
@insert_page = (id, content) ->
page = $("<article id="+id+" data-role='page' data-url="+id+" data-add-back-btn='true'>" + content + "</article>")
page.appendTo('body')
$('a' + '#' + id).click ->
$.mobile.changePage(page, {transition: "slide"})
# Use (your-view.haml)
@nolim1t
nolim1t / gist:2564199
Created May 1, 2012 01:26
Export from Plancast
request = require 'request'
exports.plancastexport = (username, callback) ->
request {url: "http://api.plancast.com/02/plans/user.json?username=" + username + "&view_type=upcoming", method: "GET"}, (error, response, body) ->
if not error
callback({body: body})
else
callback ({error: error})