Skip to content

Instantly share code, notes, and snippets.

View dotpot's full-sized avatar

Lukas Šalkauskas dotpot

  • Vilnius, Lithuania
View GitHub Profile
@dotpot
dotpot / gist:1883672
Created February 22, 2012 09:47 — forked from randym/gist:1883637
# In a controller
document = db.Text(template.render('tpl/estimate.xls',template_values),encoding="utf_8")
self.response.headers.add_header('Content-disposition', 'attachment; filename="'+seq+'.xls"')
self.response.headers.add_header('Content-type', 'application/vnd.ms-excel; filename="'+seq+'.xls"')
self.response.headers.add_header('name', seq+'.xls')
self.response.out.write(document)
@dotpot
dotpot / sc-dl.js
Created March 6, 2012 04:29 — forked from pheuter/sc-dl.js
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
@dotpot
dotpot / maximum_battery_life.md
Created March 20, 2012 05:09 — forked from mrflip/maximum_battery_life.md
maximum battery life checklist -- use before a long plane flight

Max Battery Life Checklist

Here is a checklist to follow if you want maximum battery life -- for instance if you're about to get on a long plane flight.

10 hour battery life on a non-SSD Macbook Pro 17"

Low power use checklist

With power connected:

@dotpot
dotpot / hack.sh
Created March 31, 2012 10:07 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dotpot
dotpot / tree.md
Created April 24, 2012 05:56 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@dotpot
dotpot / Tools Mac OS Must haz
Last active October 28, 2015 06:33
Tools Mac OS Must haz!
### Tools you must haz on mac os.
http://screenhero.com/ (Free colloborative screen sharing).
https://pqrs.org/macosx/keyremap4macbook/ (key remap)
http://coderwall.com/p/dlithw ( Preview all text files in finder + make text selectable )
http://code.google.com/p/macvim/
http://www.macupdate.com/app/mac/40201/dash/
http://limechat.net/mac/
http://www.macupdate.com/app/mac/30591/right-zoom/
http://spectacleapp.com/
@dotpot
dotpot / setup.sh
Created March 23, 2013 12:44 — forked from duggan/setup.sh
#!/bin/bash
set -o nounset
set -o errexit
# Install dependencies
apt-get update
apt-get install -y build-essential lua5.1 liblua5.1-0-dev python python-setuptools python-dev git-core openssl libssl-dev python-pip rsync gcc make git supervisor
pip install seesaw
git clone https://github.com/ArchiveTeam/yahoomessages-grab

Python Number Conversion Chart

From To Expression
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php