Skip to content

Instantly share code, notes, and snippets.

View mwicat's full-sized avatar

Marek Wiewiorski mwicat

View GitHub Profile
@mwicat
mwicat / postgresql_copy.py
Created January 15, 2014 00:26
postgresql copy
import psycopg2
import cPickle as pickle
import csv
from StringIO import StringIO
conn = psycopg2.connect("dbname=songs user=postgres password=pass host=localhost port=5432")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
d = pickle.load(open('songs.pickle'))
@mwicat
mwicat / pyqt_load_form.py
Created January 27, 2014 23:09
pyqt load form
import sys
import os
from PyQt4 import QtGui, uic
class MyWindow(QtGui.QMainWindow):
def __init__(self):
super(MyWindow, self).__init__()
self.show()
if __name__ == '__main__':
@mwicat
mwicat / parse_xml.py
Created April 14, 2014 18:40
parse xml example
from lxml import etree
r = etree.parse(open('upload%3fclient=Opera(98)'))
fields = r.xpath('/autofillupload/field')
[field.get('autofilltype') for field in fields]
@mwicat
mwicat / gist:686fa668ff7b269fafcabcd029305b06
Last active September 15, 2020 13:57
patch nextdevice, connect to live.path to obtain device path to the left of this patch
<pre><code>
----------begin_max5_patcher----------
1119.3oc2Y0tiiZCE82jmBDp+nUJaDlOBI8Ws80XaExD7P7VGaD1LS1cz7tW
+APvYfLzvxzYajBgbu9iiO2KGaiedkiWF6Lh649qte10w44UNNZSJCNM+2w6
D77ABjqKlGE8DK6KdqMtDnyBs4R2Rn3HU92bzi3Cn1BvpEDjP70RjoS77b+q
FWxJb3HlVjVgNHLdiR72Du1c21M9qc2GntF3uwuqJOvnBN9a51BHczXFmqwf
DWeBDFz10z5SXpry03FzqEnvS5Vv62qvPh6evH48piAwVURiTTUCqzPKx1BS
POhp3XFsWoc7fkk8L6zqJJt7KLcCsacmIL0XxuyTkjCaqeTmUXkjuDRxptxf
+yai7tzLrbTEsFqghw3KqZgjN9oF27R3ASkUg4V2Wh.f3XEqC7A5e.Qgpe2t
c2knfLCofvN72n79f1iUhnXZYEhinBnnA8ctyQO.qIhTqPXvlA8+PCFGzocz
autowatch = 1;
inlets = 1;
outlets = 1;
var ParamCallback = function() {}
ParamCallback.prototype.call = function(prop) {
if (prop[0] == 'value') {
var name = this.param.get('name')
@mwicat
mwicat / gist:24589857f0c4b46bd0a7aa4f3f0b4630
Created October 23, 2019 20:18
max for live follow selected track
<pre><code>
----------begin_max5_patcher----------
834.3ocwWsrbaBCEcM7Uvn01c.7i5zc8ancWlNLBP1VIBIFIgezN4eu5AfkH
fGG2jzMJw2idbz4Jc3p+DF.xYmPBPz2hdLJH3OgAAlP5.As+N.TAOUPfBS2.
TzQV9SfYVHI5jzDtNZKiPXG+AhfJjnxexgEO20KVijfjxy0H6JA.Q+pEZKiJ
E3ea.Rh+RbaXboYVUqz7UqAN8kBqL8E7cNFR5PnMUXpZILTL9RP6BahlzFsF
JK1io6x3JdZoSxCqUKbTRhoMdi9OoJtzSRyXP7VUoUVT7ASPGPbAlQcVg..r
t1IbfyPzZ4SLyDsYVeHL0FJoODGc.2M939nPth4REsa3VM3z5kfKSCqDwoMX
yLYC9RXGkL4Os1IpgE1AqSycvWzhEOX18KMZQ5BiVj7fiXnNerivJdFU5RN.
qFQwzZNRfnRnb.2AknsvFhLa7zsO91VFNJ3n4+.vNNtjQ0jvKSnC2sbp7rMM
import os
import apache_log_parser
from pyspark.sql import Row
from user_agents import parse as ua_parse
path = os.path.join(os.getcwd(), 'logs', 'req.log')
fmt = "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %{Host}i"
#!/usr/bin/python
#
# Open SoundControl for Python
# Copyright (C) 2002 Daniel Holth, Clinton McChesney
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
@mwicat
mwicat / boost_sox.cpp
Created May 24, 2020 22:30
boost sox
int result = bp::system(
bp::search_path("sox"),
"--norm=-0.1",
"ableton sampler lovely keys.wav",
"ableton sampler lovely keys2.wav",
"silence",
"1", "0.1", "1%",
bp::std_err > "is");
@mwicat
mwicat / tampermonkey_youtube_timestamp.js
Last active June 9, 2020 16:38
tampermonkey_youtube_timestamp.js
// ==UserScript==
// @name YouTube add timestamped link
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Automatically update link with timestamp that you may later use for bookmarking
// @author mwicat
// @match *://www.youtube.com/watch*
// @grant none
// ==/UserScript==