Skip to content

Instantly share code, notes, and snippets.

@alexswider
alexswider / osx_install.sh
Last active November 6, 2016 17:59 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@alexswider
alexswider / gist:585d4eaeee5030219217
Last active September 11, 2015 15:19 — forked from howtogeek/gist:6b3ed7d917900229b37e
Change font to Comic Sans if reader is using Adblock (and display a message at the top)
<script type="text/javascript">
var iframe = document.createElement("iframe");
iframe.height = "1px";
iframe.width = "1px";
iframe.id = "ads-text-iframe";
iframe.src = "/adframe.js";
document.body.appendChild(iframe);
var a = [
"In a world free from ads, one font reigns supreme. COMIC SANS!",
@alexswider
alexswider / tumblr-lightbox-for-photos.js
Last active September 8, 2015 20:58 — forked from ara303/tumblr-lightbox-for-photos.js
Demonstration of how to use Tumblr's built-in Lightbox() method to create a simple lightweight "presentation mode" for photo posts. This is advantageous over creating a whole new lightbox script because this code's already available (Tumblr use it for Photoset posts).
$(function(){ // shorthand document.ready()
$('.make_lightbox').each(function(){ // this is just an element I let them click, it carries a series of data- attributes.
$(this).on('click',function(){ // when clicked. this is the newer jQuery click() handler that's only in v1.8+ so that may be something to note.
var lbArray = []; // create blank array.
var arrayContents = {"width":$(this).data('width'), "height":$(this).data('height'), "low_res":$(this).data("lowres"), "high_res":$(this).data('highres')}; // make set of the data- attributes.
lbArray.push(arrayContents); // push the set into the array.
Tumblr.Lightbox.init(lbArray,1); // trigger Tumblr lightbox. the '1' is the number of photos it expects. specific to how tumblr has things set up.
$('body').toggleClass('tumblr_lightbox_active'); // use this to prevent the user from scrolling.
});
});
#!/usr/bin/python
import time
from SimpleCV import Color, Image, np, Camera
cam = Camera() #initialize the camera
quality = 400
minMatch = 0.3
try:
password = Image("password.jpg")
var serialport = require('node-serialport')
var sp = new serialport.SerialPort("/dev/ttyO3", {
parser: serialport.parsers.raw,
baud: 9600
})
sp.on('data', function(chunk) {
console.log(chunk.toString('hex'), chunk.toString(), chunk)
})
<?php
include "utils.php";
$fp = parse_fp($_GET['fp']);
$dbh = new PDO('mysql:host=localhost;dbname=fingerprint', 'fingerprint');
$dbh->beginTransaction();
$sth = $dbh->prepare("INSERT INTO fp (length) VALUES (?)");