Skip to content

Instantly share code, notes, and snippets.

View migonzalvar's full-sized avatar

Miguel Gonzalez migonzalvar

  • Vigo, Pontevedra, Spain
View GitHub Profile
#! /usr/bin/env python3
import argparse
from fnmatch import fnmatch
from os import walk
from os.path import join, normpath
parser = argparse.ArgumentParser()
#! /usr/bin/env python3
""" tee.py - Tee a file. """
import sys
# Parse arguments
file_name = sys.argv[1]
with open(file_name, 'wt') as file_out:
#! /usr/bin/env python3
""" cat.py - Print a file. """
import sys
# Parse arguments
file_name = sys.argv[1]
with open(file_name, 'rt') as f:
#! /usr/bin/env python3
""" grep.py - Search a string in a file. """
import sys
# Parse arguments
pattern, file_name = sys.argv[1:3]
with open(file_name, 'rt') as f:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@migonzalvar
migonzalvar / imageholder.py
Created March 6, 2014 18:20
Create a square image. Requires PIL (or pillow)
#!/usr/bin/env python
"""Create a square image. Usage:
$ imageholder.py filename size color
"""
import sys

Enable offline install using pip

This works as expected:

# export PIP_NO_INDEX=true                             
# export PIP_FIND_LINKS=http://xsce.activitycentral.com/wheelhouse/pip/ 
%define git_version %(git describe --tags 2> /dev/null || echo 0.0-`git log --oneline | wc -l`-g`git describe --always`)
%define git_get_ver %(echo %{git_version} | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+\\)-g.*$/\\1/;s/-//')
%define git_get_rel %(echo %{git_version} | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+-g.*\\)$/\\2/;s/-/_/')
Name: xsce-virtual
Summary: XSCE virtual package to isolate xs-config and xs-tools dependencies
Version: %git_get_ver
Release: %git_get_rel
License: GPLv3
import os
import re
import time
import subprocess
import ajenti
from ajenti.api import *
from ajenti.api.http import *
from ajenti.plugins import manager