Skip to content

Instantly share code, notes, and snippets.

View archf's full-sized avatar

Felix Archambault archf

View GitHub Profile
@halberom
halberom / play.yml
Last active August 29, 2015 14:18
ansible - examples of the different forms of yaml
---
- hosts: foo
tasks:
- name: single line plain style
file: path=/tmp/foo state=touch
- name: multi line plain style
file: path=/tmp/foo
state=absent
@ya-pulser
ya-pulser / to-avangard.bat
Created April 3, 2012 17:33
Set of cmd/bat files to turn routing under Windows 7 from one network card to other
route delete 0.0.0.0
set INTERFACE=11
set ROUTER=192.168.12.1
route add 0.0.0.0 MASK 0.0.0.0 %ROUTER% IF %INTERFACE%
netsh interface ip set dns %INTERFACE% static %ROUTER% register=primary validate=no
netsh interface ip add dns %INTERFACE% 212.48.193.36 index=2 no
netsh interface ip add dns %INTERFACE% 8.8.8.8 index=3 no
@unbracketed
unbracketed / gist:228457
Created November 7, 2009 01:45
Django virtualenv postactivate hook
#I usually drop something like this into my virtualenv's postactivate for some
#quick and handy shortcuts to common Django commands.
#This way dropping in to do some work on any arbitrary project is as easy as:
# 1. workon <project name>
# 2. djr
cd /path/to/site/root
#Django command shortcuts
alias dj='python manage.py'
@Flushot
Flushot / jinja2_dateformat.py
Created June 14, 2013 23:09
Jinja2 filter that formats a date and optionally localizes it to client timezone
from dateutil import tz
from jinja2 import Undefined
client_timezone = tz.gettz('PST8PDT') # timezone to translate to
@app.template_filter()
def dateformat(value, format=None, rebase=True):
if value is None or isinstance(value, Undefined):
return ''
@managai
managai / gist:1292409
Created October 17, 2011 11:12
(bash) Measure Elapsed Time
#!/bin/bash
#
# Elapsed time. Usage:
#
# t=$(timer)
# ... # do something
# printf 'Elapsed time: %s\n' $(timer $t)
# ===> Elapsed time: 0:01:12
#
#
@mouseroot
mouseroot / ip_routing_win7.txt
Created April 30, 2013 16:41
Enable IP Routing in Windows 7
1. Open regedit
2. Navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"
3. Change IPEnableRouter to 1
4. Run services->Routing and Remote->start
(reboot may be nessesary)
@jarrettmeyer
jarrettmeyer / insert_data.py
Last active April 8, 2022 07:10
Inserting data into HBase with Python
#!/usr/bin/env python
"""
Insert data into HBase with a Python script.
To create the table, first use the hbase shell. We are going to create a
namespace called "sample_data". The table for this script is called "rfic",
as we will be inserting Request for Information Cases from the City of
Indianapolis.
@andrewwatts
andrewwatts / request_time.py
Created March 10, 2012 19:33
urllib2 vs urllib3 vs requests
#!/usr/bin/env python2.7
import time
_URL = 'http://localhost/tmp/derp.html'
_NUMBER = 1000
def test_urllib2():
import urllib2
@maurizi
maurizi / ansible-galaxy.bat
Last active December 16, 2022 11:34
Running Ansible on Windows
@echo off
cygwin-shim.bat /bin/ansible-galaxy %*
@korya
korya / Subfolder to git repo.md
Last active December 16, 2023 10:29
Convert subfolder into Git submodule