Skip to content

Instantly share code, notes, and snippets.

View kotfic's full-sized avatar

Christopher Kotfila kotfic

  • Kitware
  • Washington DC
View GitHub Profile
@kotfic
kotfic / backbone_htauth
Created March 30, 2012 21:08
Duck punching for fun and profit
Backbone._sync = Backbone.sync;
Backbone.sync = function(method, model, options) {
options = _.extend( options, {
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + window.btoa( localStorage['assembla_username'] + ":" + localStorage['assembla_password'] ) );
} });
return Backbone._sync( method, model, options );
};
(defadvice org-babel-python-evaluate (before org-babel-ipython-evaluate
(arg session body &optional result-type result-params preamble) activate)
(setq body (concat "%cpaste\n" body "\n--\n")))
@kotfic
kotfic / gist:6131991
Created August 1, 2013 14:36
ffmpeg issue
kotfic@carasgaladon:~/music/VA-This_is_Dubstep_2013/This_Is_Dubstep_2013_pt1$ ffmpeg -i 02\ Too\ Close\ \(Distance\ Remix\).m4a -acodec libmp3lame -ac 2 -ab 128 output.mp3
ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 11 2013 16:46:25 with gcc 4.8.1 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-vdpau --enable-version3 --enable-x11grab
WARNING: library configuration mismatch
swscale configuration: --prefix=/usr --incd

to .docx

(file-truename (org-latex-export-to-latex))
@kotfic
kotfic / scratch.py
Last active December 21, 2015 04:39
Base = declarative_base()
wtp_data_petition_responses = Table('wtp_data_petition_responses', Base.metadata,
Column('petition_id', String(64)),
Column('response_id', String(64)),
Column('association_time', Integer(11)))
class Response(Base):
__tablename__ = 'wtp_data_responses'
id = Column(String(64), primary_key=True)
class Petition_Response(Base):
__tablename__ = 'wtp_data_petition_responses'
petition_id = Column(String(64), primary_key=True),
response_id = Column(String(64)),
association_time = Column( Integer(11))
response = relationship("Response", backref=backref('association'))
petition = relationship("Petition", backref=backref('association'))
import time
import pynotify
pynotify.init("Basic")
def notify(s, title=""):
n = pynotify.Notification(title, s)
n.show()
def get_time(qtile):
import re
class SoupProxy(object):
def __init__(self, contents, **kwargs):
try:
self.contents = contents.read()
except AttributeError:
self.contents = contents
@kotfic
kotfic / emacs.el
Last active January 3, 2016 12:29
(dir-locals-set-class-variables 'py2-directory
'(( py-mode . (( jedi:server-command . '("python2" jedi:server-script))
( jedi:server-args . "--sys-path /home/kotfic/.local/lib/python2.7/site-packages/")
( py-shell-name . "ipython2" )
)
)))
(dir-locals-set-directory-class "/home/kotfic/.config/qtile/" 'py2-directory)
kotfic@carasgaladon:~/src/IPython$ ipython
Traceback (most recent call last):
File "/home/kotfic/.local/bin/ipython", line 5, in <module>
from IPython import start_ipython
File "/home/kotfic/.local/lib/python2.7/site-packages/IPython/__init__.py", line 43, in <module>
from .config.loader import Config
File "/home/kotfic/.local/lib/python2.7/site-packages/IPython/config/__init__.py", line 16, in <module>
from .application import *
File "/home/kotfic/.local/lib/python2.7/site-packages/IPython/config/application.py", line 29, in <module>
from IPython.external.decorator import decorator