Skip to content

Instantly share code, notes, and snippets.

@zlalanne
zlalanne / Python-CDATA.py
Created June 5, 2013 05:48
Adds CDATA support to Python ElementTree
import xml.etree.ElementTree as ET
def CDATA(text=None):
element = ET.Element('![CDATA[')
element.text = text
return element
ET._original_serialize_xml = ET._serialize_xml
@zlalanne
zlalanne / tmux_cygwin.md
Last active February 3, 2023 23:33
tmux on Cygwin

Steps to install tmux in Cygwin

Install required Cygwin packages

  1. run Cygwin setup.exe
  2. install these packages that are not installed by default: automake, gcc, git and pkg-config

Install libevent

  1. browse http://libevent.org
  2. download libevent-2.0.21-stable.tar.gz
@zlalanne
zlalanne / resume.tex
Last active July 9, 2021 03:48
My LaTeX Resume that uses moderncv
%% start of file `template.tex'.
%% Copyright 2006-2013 Xavier Danaux (xdanaux@gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
\documentclass[11pt,a4paper,sans]{moderncv} % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')
\usepackage{tabularx}
@zlalanne
zlalanne / PDFMerge.py
Last active October 26, 2020 03:21
Python script to merge a folder of pdfs, can define order in list.txt contained within the directory
#!/usr/bin/env python
"""
Simple Python script that combines a folder of pdfs into a single
pdf. By default the pdfs are merged in alphabetical order and
only appear once. To change this create a "list.txt" file in the
directory with the pdfs to merge and list the order of the pdfs
to merge.
Ex list.txt:
doc2.pdf
#!/usr/bin/env python3
"""
Usage:
dev_installccs [OPTIONS] <ccs_version>
dev_installccs (--help|-h)
dev_installccs (--version|-v)
Options:
"""
@zlalanne
zlalanne / link.py
Created February 12, 2013 02:54
Python script to link files once deluge finishes downloading

Keybase proof

I hereby claim:

  • I am zlalanne on github.
  • I am zlalanne (https://keybase.io/zlalanne) on keybase.
  • I have a public key ASBg0d_wurlf9zLV2WNiEFWuV7jpumqsr32LV2czBctHAwo

To claim this, I am signing this object:

@zlalanne
zlalanne / which.ps1
Last active December 31, 2015 21:29
Equivalent unix which for powershell
foreach($arg in $args)
{
Get-Command $arg | Select-Object -ExpandProperty Definition
}
@zlalanne
zlalanne / node_text.py
Created December 10, 2013 18:58
Get the text of a node and all child nodes into a string
def get_node_text(root):
text = ""
if root.text:
text = root.text.strip()
for child in root:
text += get_node_text(child)
if root.tail:
@zlalanne
zlalanne / dlfile.py
Last active December 25, 2015 13:09
Download a file using urllib2
def dl_file(url, directory=os.path.dirname(__file__), user=None, password=None, filename=None):
"""
Download a file from a url to a directory
@param url: url of a file
@param directory: directory to save the file into
@return: True if file was downloaded successfully, False otherwise
"""
# Disable the proxy