This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'Rmagick' | |
include Magick | |
# In pixels | |
SQUARE_SIZE = 20 | |
CORNER = 2 | |
SPIKE_OFFSET, SPIKE_WIDTH, SPIKE_HEIGHT = 7, 4, 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "MSImageView.h" | |
#import <Three20Network/TTURLCache.h> | |
#import <Three20Network/TTURLImageResponse.h> | |
#import <Three20Network/TTURLRequest.h> | |
#import "MSGlobals.h" | |
@implementation MSImageView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ImageMagick `identify` format features is handy | |
# e.g. to obtain the width x height of a given image (360x480) | |
# | |
# See http://www.imagemagick.org/script/escape.php | |
# for a complete list of supported format characters | |
identify -format "%wx%h" myimage.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -E is for preprocessor only | |
# -dM tells GCC to generate a list of #define directives | |
# e.g. | |
# #define __APPLE__ 1 | |
# #define __SSE2__ 1 | |
# #define __GNUC__ 4 | |
# ... | |
gcc -E -dM - < /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* NOTES: | |
* - iOS: the useful macros are defined within TargetConditionals.h | |
* - Android: | |
* - with Android.mk file(s) and the 'ndk-build' script (aka vanilla way), | |
* ANDROID is predefined (see -DANDROID extra C flag), | |
* - with the Android Standalone Toolchain __ANDROID__ is predefined instead | |
*/ | |
#if defined(__APPLE__) | |
#include <TargetConditionals.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <sys/system_properties.h> | |
/* Get device name | |
-- | |
1/ Compile with the Android NDK Toolchain: | |
arm-linux-androideabi-gcc -static pname.c -o pname | |
2/ Transfer on device: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <objc/runtime.h> | |
#include <objc/message.h> | |
#include <CoreFoundation/CoreFoundation.h> | |
/* ... */ | |
/** | |
* Return a character string that holds the current version | |
* of the operating system which is equivalent to: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nslookup | |
> set q=MX | |
> github.com | |
Server: 212.27.40.240 | |
Address: 212.27.40.240#53 | |
Non-authoritative answer: | |
github.com mail exchanger = 10 ALT1.ASPMX.L.GOOGLE.com. | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
log_format filt '$remote_addr - $remote_user [$time_local] "$_request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
server { | |
location /login { | |
# `set` is provided by the Rewrite module | |
set $filter "password|secret"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `head -c bytes` | |
# e.g. for a 1kb file: | |
cat /dev/random | head -c 1024 > data.bin |
OlderNewer