Skip to content

Instantly share code, notes, and snippets.

View alfredodeza's full-sized avatar
:octocat:

Alfredo Deza alfredodeza

:octocat:
View GitHub Profile
@alfredodeza
alfredodeza / .vimrc
Created March 7, 2016 13:45
Read non-plaintext file types in Vim
" requires pandoc, the newest the version the better
autocmd BufReadPost *.doc,*.docx,*.rtf,*.odp,*.odt silent %!pandoc "%" -tplain -o /dev/stdout
@alfredodeza
alfredodeza / unmask.js
Created December 1, 2015 13:31
Unmask **** passwords
var els = document.getElementsByTagName('input'); for(var x = 0; x < els.length; x++) { if(els[x].type.toLowerCase() == 'password' ) { var test = els[x].type = 'text'; } }
@alfredodeza
alfredodeza / how-to.txt
Last active February 2, 2024 18:47
pdf output from sphinx with rst2pdf
1. Install rst2pdf
- use your package manager (or)
- pip install rst2pdf (or)
- easy_install rst2pdf
2. Add rst2pdf to the list of extensions in conf.py
extensions = ['rst2pdf.pdfbuilder']
@alfredodeza
alfredodeza / prepare-commit-msg
Last active October 19, 2015 20:06
prefix commit messages with branch names
#!/usr/bin/python
"""
This is a prepare-commit-msg hook that fill prefix commit messages with
[BRANCH]
Copy this file to $GITREPOSITORY/.git/hooks/prepare-commit-msg
and mark it executable.
Assumes your branch is based off of a tracker ID
"""
@alfredodeza
alfredodeza / whisper.vim
Created May 11, 2015 14:28
map the undo to whisper balls
" I don't remember exactly how to make it not spit out the actual command you are running. Meh.
nnoremap u :call system("say -v whisper 'balls'")<CR>
@alfredodeza
alfredodeza / unmask.js
Created April 28, 2015 13:04
Unmask passwords
var els=document.getElementsByTagName('input'); for(var x = 0; x < els.length; x++) { if(els[x].type.toLowerCase() == 'password' ) { var test = els[x].type = 'text'; } }
@alfredodeza
alfredodeza / new_repo.sh
Created April 7, 2015 16:54
new Ceph release repo
# create the new rpm directory
mkdir rpm-hammer
cd rpm-hammer
# make the directories for the distros we need for x86_64
mkdir -p el6/x86_64/
mkdir -p el7/x86_64/
mkdir -p fc20/x86_64/
mkdir -p rhel6/x86_64/
mkdir -p rhel7/x86_64/
@alfredodeza
alfredodeza / generate.py
Created November 7, 2014 03:02
a simple markov phrase generator
import random
class Markov(object):
def __init__(self, open_file):
self.cache = {}
self.open_file = open_file
self.words = self.file_to_words()
self.word_size = len(self.words)
@alfredodeza
alfredodeza / real.py
Last active April 26, 2022 10:58
Real time subprocess stdout/stderr
import logging
import threading
import os
import subprocess
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
class LogPipe(threading.Thread):
@alfredodeza
alfredodeza / gist:77e623624246c4b92b9f
Created August 30, 2014 21:31
Trying to use py.test fixtures with Pecan + SQLAlchemy
# app name: ayni
# this works, inheriting from it, committing and re-using the database
#
# ayni model __init__.py file doesn't have anything odd and can be found:
# https://github.com/alfredodeza/ayni/blob/master/ayni/models/__init__.py
#
import os
from unittest import TestCase
from pecan import set_config
from pecan.testing import load_test_app