Skip to content

Instantly share code, notes, and snippets.

CGFloat BNRTimeBlock (void (^block)(void));
curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary '
{ "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } }
{ "name" : "auchan", "owner" : "chris" }
{ "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } }
{ "name" : "toys", "numberOfProducts" : 150 }
{ "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } }
{ "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" }
'

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

// .h
@interface AMPNavigationBar : UINavigationBar
@property (nonatomic, assign) CGFloat extraColorLayerOpacity UI_APPEARANCE_SELECTOR;
@end
// .m
BTW yum has last Redis too, remi repository at least.
$ sudo -i
$ yum list redis
$ redis.x86_64 2.6.13-1.el6.remi remi
But today we want compile redis from source (see http://redis.io/download)
$ yum install make gcc tcl
$ cd /usr/local/src
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@skeeet
skeeet / build_ota.sh
Last active August 29, 2015 14:07 — forked from skabber/build_ota.sh
#!/bin/sh
# This script was written by Jay Graves for the 360iDev Conference.
# You can find the full slides available at http://skabber.com/
# This script requires Xcode and s3cmd http://s3tools.org/s3cmd
# You will need your own Amazon S3 account to upload files.
# Put your distribution certificates and keys in the System Keychain
# otherwise you will need to use security unlock-keychain
TARGET=GroupA
PlistBuddy=/usr/libexec/PlistBuddy

Usage

Requirements

Install the two dependencies, ImageMagick and Ghostscript.

$ brew install imagemagick
$ brew install ghostscript
#!/bin/sh
#ID='A16FF353-8441-459E-A50C-B071F53F51B7' # Xcode 6.2
#ID='992275C1-432A-4CF7-B659-D84ED6D42D3F' # Xcode 6.3
#ID='E969541F-E6F9-4D25-8158-72DC3545A6C6' # Xcode 6.3.2
ID=`/usr/libexec/PlistBuddy -c 'Print DVTPlugInCompatibilityUUID' "$(xcode-select -p)/../Info.plist"`
PLIST_BUDDY=/usr/libexec/PlistBuddy
@skeeet
skeeet / pre-commit-clang-format
Last active August 29, 2015 14:27 — forked from wangkuiyi/pre-commit-clang-format
Git pre-commit hook that invokes clang-format to reformat C/C++/Objective-C source code.
#!/bin/bash
# git pre-commit hook that runs an clang-format stylecheck.
# Features:
# - abort commit when commit does not comply with the style guidelines
# - create a patch of the proposed style changes
# modifications for clang-format by rene.milk@wwu.de
# This file is part of a set of unofficial pre-commit hooks available
# at github.