Skip to content

Instantly share code, notes, and snippets.

View martin12333's full-sized avatar

Martin Milan martin12333

View GitHub Profile
@martin12333
martin12333 / hw.py
Created June 30, 2011 17:17
a simple script that shows a window using GTK
#!/usr/bin/env python
# from wikipedia
import gtk
def create_window():
window = gtk.Window()
window.set_default_size(200, 200)
window.connect('destroy', gtk.main_quit)
BEGIN {
FS=","
OFS=","
}
{
for (i=2; i<=NF; i++)
print $i, $1
}
@martin12333
martin12333 / mynote.xml
Last active August 29, 2015 14:27 — forked from xiaoganghan/mynote.xml
Parsing Evernote export file (.enex) using Python
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export2.dtd">
<en-export export-date="20120727T073610Z" application="Evernote" version="Evernote Mac 3.0.5 (209942)">
<note><title>Vim Tips</title><content><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
yank for copy, delete for cut, put for parse
<div><br/></div>
<div>Move in context, not position</div>
<div>/ search forward</div>
//Assuming that you're using version 2.1, then you could dig into the Javascript source code of your Google Refine download and hack this feature. Take a look at this file and line:
//http://code.google.com/p/google-refine/source/browse/tags/2.1/main/webapp/modules/core/scripts/views/data-table/cell-ui.js#75
//You would want to change it to something like this
} else if (URL.looksLikeUrl(cell.v)) {
if (cell.v.endsWith(".jpg") || cell.v.endsWith(".jpeg") || cell.v.endsWith(".png")) {
$('<img>')
.attr("src", cell.v)
/*
Copyright 2010, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
@martin12333
martin12333 / lxd-wayland-gui.md
Created May 19, 2018 12:21 — forked from stueja/lxd-wayland-gui.md
GUI application via Wayland from Ubuntu LXD container on Arch Linux host
@martin12333
martin12333 / qubes-authentication.md
Created May 26, 2018 18:21 — forked from tildelowengrimm/qubes-authentication.md
Qubes OS authentication info
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

When I install software, I'd prefer to have a secure delivery mechanism. Qubes OS uses a relatively robust system. A master signing key is kept on a “dedicated, air-gapped "vault" machine”. This key certifies dedicated keys for each major release.

Sadly, I don't have a good way to verify the Qubes master signing key. Instead, I tried downloading the Qubes key packet from various different network endpoints, and over a bunch of different Tor circuits. I asked some friends to try the same thing. We all got the same results.

@martin12333
martin12333 / BCI_AV-meanings_n.xls.openrefine.txt.json
Last active November 18, 2018 10:26
(a recorded "macro") ... BCI_AV-meanings_n.xls.openrefine
[
{
"op": "core/text-transform",
"description": "Text transform on cells in column Derivation - explanation using expression grel:value.replace(/\\t/,' --- ')",
"engineConfig": {
"facets": [],
"mode": "row-based"
},
"columnName": "Derivation - explanation",
"expression": "grel:value.replace(/\\t/,' --- ')",
@martin12333
martin12333 / hack
Created March 19, 2019 17:16 — forked from Jermolene/hack
Word counting hack for TiddlyWiki 5.1.7
var tag="mytag";r="";$tw.wiki.each(function(t){if(t.hasTag(tag)){r=r+" "+(t.fields.text||"")}});r.trim().replace(/\s+/gi," ").split(" ").length
@martin12333
martin12333 / canvas2png.js
Created March 24, 2019 16:48 — forked from jberryman/canvas2png.js
A jQuery one-liner for converting all html5 canvas elements in the DOM to PNGs
$('canvas').each(function(i,e){ var img = e.toDataURL("image/png"); $(e).replaceWith( $('<img src="'+img+'"/>').attr({width: $(e).attr("width"), height: $(e).attr("height"), style: $(e).attr("style") }) ) });