Skip to content

Instantly share code, notes, and snippets.

View mardix's full-sized avatar

Mardix mardix

View GitHub Profile
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@mardix
mardix / SASS Responsive mixin
Last active August 29, 2015 14:20
Responsive Mixin
// _responsive_mixin.scss
$font : "Lato", sans-serif;
// Text Colors
$text-color: #111;
$text-light-color: #B9B9B9;
$text-lighter-color: #fff;
$text-dark-color: #1E1E1E;
$text-darker-color: #111;
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
# Allow to create pages for testing purposes
from datetime import datetime
import random
import string
import shutil
import os
def generateWord():
@mardix
mardix / .vscode-settings.json
Last active March 30, 2017 23:15
My VSCode Settings
{
"python.pythonPath": "/Users/Mardix/.virtualenvs/${workspaceRootFolderName}/bin/python"
}
import frontmatter
from frontmatter import Post as FMPost
def frontmatter_to_file(file, data={}, content=""):
p = FMPost(content=content, **data)
with open(file, "w") as f:
f.write(frontmatter.dumps(p))
@mardix
mardix / python_over_ssh
Created March 21, 2017 07:05 — forked from mattyjones/python_over_ssh
Execute a script located on a remote server over ssh using python
#! /usr/bin/env python
import secure
import pexpect
# the file containing the list of servers to log into
input_file = "script_list"
# The login creds
user = secure.USER
@mardix
mardix / DOMClass.js
Created December 8, 2018 21:23 — forked from Maksims/DOMClass.js
HTMLElement extension to add, remove, toggle, detect Classes.
HTMLElement = typeof(HTMLElement) != 'undefiend' ? HTMLElement : Element;
HTMLElement.prototype.addClass = function(string) {
if (!(string instanceof Array)) {
string = string.split(' ');
}
for(var i = 0, len = string.length; i < len; ++i) {
if (string[i] && !new RegExp('(\\s+|^)' + string[i] + '(\\s+|$)').test(this.className)) {
this.className = this.className.trim() + ' ' + string[i];
}
/**
* Produces a function which uses template strings to do simple interpolation from objects.
*
* Usage:
* var makeMeKing = generateTemplateString('${name} is now the king of ${country}!');
*
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
* // Logs 'Bryan is now the king of Scotland!'
*/
var generateTemplateString = (function(){
@mardix
mardix / gist:c96e1ce96ba0f544d7dd21b50867d91f
Last active April 24, 2019 06:14
Python Package Development
## Create virtualenv
> mkvirtualenv $name
> workon $name
## Develop
To install
> python setup.py develop