Skip to content

Instantly share code, notes, and snippets.

View dtolj's full-sized avatar

Dejan Tolj dtolj

  • Toronto, Canada
View GitHub Profile
@nazarewk
nazarewk / ansible.cfg
Last active August 2, 2021 20:27
Ansible SSH Agent forwarding with Jump (bastion) host
[defaults]
sudo_flags = SSH_AUTH_SOCK="$SSH_AUTH_SOCK" -H -S -n
[ssh_connection]
ssh_args=-o ForwardAgent=yes
## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/
---
- hosts: alpine_install
user: root
tasks:
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile
@DavidWittman
DavidWittman / notes.md
Created February 22, 2012 18:54
A Brief Introduction to Fabric

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

'''
Copyright (c) 2011 Joar Wandborg <http://wandborg.se>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T
@yunazuno
yunazuno / uridecodebin.py
Created March 2, 2011 04:56
Audio autoplugin example using 'uridecodebin' element
#!/usr/bin/env python
# uridecodebin.py - Audio autoplugin example using 'uridecodebin' element
#
# Based on:
# decodebin.py - Audio autopluging example using 'decodebin' element
# Copyright (C) 2006 Jason Gerard DeRose <jderose@jasonderose.org>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# This file is part of pylastfp.
# Copyright 2010, Adrian Sampson.
#
# pylastfp is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# pylastfp is distributed in the hope that it will be useful,

Essential

  • rails
  • passenger
  • mysql
  • sqlite3-ruby
  • haml
  • compass
  • bluecloth
  • nifty_generators
anonymous
anonymous / gist:469510
Created July 9, 2010 14:21
desc "Fetch product prices"
task :updatepayouts => :environment do
require 'mechanize'
agent = WWW::Mechanize.new
Offer.find_all_by_payout(nil).each do |offer|
escaped_offer_name = CGI.escape(offer.name)
agent.get("http://odigger.com/?&q=&quot;#{escaped_offer_name}&quot;&network_id=")
agent.page.search(".payout").each do |offer2|
offer.update_attribute(:payout, offer2.text.strip)
end
@sit
sit / gitproxy-socat
Created January 20, 2009 02:30
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny