Skip to content

Instantly share code, notes, and snippets.

View dotpot's full-sized avatar

Lukas Šalkauskas dotpot

  • Vilnius, Lithuania
View GitHub Profile
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original
# for Mountain Lion 10.8.3 - 10.8.4
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.1-10.8.2 and Lion 10.7.5
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.0 and Lion 10.7.4 BELOW
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x51)|

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

import logging
from logging import config
ON_LOGGERS = True
config.dictConfig({
'version': 1,
'formatters': {
'fmt_root': {'format': '[ / ] - %(levelname)s - %(name)s - %(message)s'},
'fmt_pkg': {'format': '[ /pkg ] - %(levelname)s - %(name)s - %(message)s'},
'fmt_pkg_sub': {'format': '[ /pkg/sub ] - %(levelname)s - %(name)s - %(message)s'},

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@dotpot
dotpot / temp.py
Last active August 29, 2015 14:23 — forked from Paulius-Maruska/temp.py
def space(s, n):
"""inserts a space every n characters in string s
>>> space('0123456789', 3)
'012 345 678 9'
>>> space('0123456789', 4)
'0123 4567 89'
"""
return ' '.join(s[i:i+n] for i in range(0, len(s), n))
@dotpot
dotpot / springer-free-maths-books.md
Created December 28, 2015 21:51 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@dotpot
dotpot / app.py
Created January 17, 2017 10:39 — forked from jmvrbanac/app.py
Using Jinja2 with Falcon
import os
import falcon
import jinja2
def load_template(name):
path = os.path.join('templates', name)
with open(os.path.abspath(path), 'r') as fp:
return jinja2.Template(fp.read())
@dotpot
dotpot / UninstallBoomDevice.scpt
Created June 6, 2017 11:43
Uninstall BoomDevice (Mac) apple script.
on run
do shell script "sudo kextunload -b com.globaldelight.driver.BoomDevice" with administrator privileges
do shell script "sudo rm -rf /System/Library/Extensions/BoomDevice.kext" with administrator privileges
do shell script "sudo rm -rf /Library/Extensions/BoomDevice.kext" with administrator privileges
end run

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets