Skip to content

Instantly share code, notes, and snippets.

View planetexpress69's full-sized avatar

Martin planetexpress69

  • Bruce & Bifi
View GitHub Profile
@planetexpress69
planetexpress69 / gist:4452146
Last active December 10, 2015 15:08
Some jibberish to make a Raspberry Pi running Raspbian Wheezy more stable...
cat /boot/cmdline.txt
dwc_otg.speed=1 dwc_otg.microframe_schedule=1 dwc_otg.fiq_fix_enable=1 dwc_otg.lpm_enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
@planetexpress69
planetexpress69 / gist:6240651
Created August 15, 2013 13:02
Get all seamarks of Rostock from Open Sea Map (OSM) using the Overpass-API.
URL: http://overpass-api.de/query_form.html
Query: (node(54.085, 11.867, 54.2503, 12.320);<;);out;
This returns a file roughly 45 MB in size.
Extract the seamarks stuff by using PHP:
<?php
echo '<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
@planetexpress69
planetexpress69 / gist:7c5e6082765528f3e2a7
Last active August 29, 2015 14:06
Extracting some stuff...
- (NSDictionary *)extract:(NSString *)sPayload
{
NSError *regexError = nil;
NSString *sPattern = @"MACRO_NET_WORK_TYPE_[0-9A-Z _]{1,}=[ ]{1,}'[0-9]{1,}'";
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:sPattern
options:NSRegularExpressionCaseInsensitive
error:&regexError];
if (sPayload == nil) {
NSLog(@"Gimme some real food...");
return nil;
@planetexpress69
planetexpress69 / gist:7bf3d450d86491bfd51d
Last active August 29, 2015 14:06
Improved extract - no line splitting required as regex can find multiple matches... returns a NSDictionary<NSString, NSNumber>
- (NSDictionary *)extract:(NSString *)sPayload
{
NSError *regexError = nil;
NSString *sPattern = @"MACRO_NET_WORK_TYPE_[0-9A-Z _]{1,}=[ ]{1,}'[0-9]{1,}'";
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:sPattern
options:NSRegularExpressionCaseInsensitive
error:&regexError];
if (sPayload == nil) {
NSLog(@"Gimme some real food...");
return nil;
@planetexpress69
planetexpress69 / gist:91d73c8251d7d1377e1f
Created October 24, 2014 14:01
O look, a simple view made by UIAlertController..
(lldb) po [loginController.view recursiveDescription]
<_UIAlertControllerView: 0x78ecf2e0; frame = (25 4; 270 256); layer = <CALayer: 0x78ecf550>>
| <UIView: 0x78ecf6c0; frame = (0 0; 270 256); animations = { <_UIParallaxMotionEffect: 0x79a47f10>=<CAAnimationGroup: 0x79a80530>; }; layer = <CALayer: 0x78ecf730>>
| | <_UIDimmingKnockoutBackdropView: 0x78f54ba0; frame = (0 0; 270 256); clipsToBounds = YES; layer = <CALayer: 0x78f54d30>>
| | | <UIView: 0x79a66f00; frame = (0 0; 270 256); clipsToBounds = YES; layer = <CALayer: 0x79a67540>>
| | | <_UIBackdropView: 0x78f54e60; frame = (0 0; 270 256); clipsToBounds = YES; opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <_UIBackdropViewLayer: 0x78f55100>>
| | | | <_UIBackdropEffectView: 0x79a70c60; frame = (0 0; 270 256); clipsToBounds = YES; opaque = NO; autoresize = W+H; userInteractionEnabled = NO; animations = { filters.colorMatrix.inputColorMatrix=<CABasicAnimation: 0x79aa4490>; }; layer = <CABackdropLaye
func get(path: String) {
let url = NSURL(string: path)
let session = NSURLSession.sharedSession()
running = true
let task = session.dataTaskWithURL(url!, completionHandler: {
[unowned self] (data, response, error) -> Void in
println("Task completed")
if(error != nil) {
// If there is an error in the web request, print it to the console
println(error.localizedDescription)
@planetexpress69
planetexpress69 / gist:ddb7649e65f5a5f7e6e3
Created December 17, 2015 13:12
Hacked mapbox-marker component for Ember
import Ember from 'ember';
import layout from '../templates/components/mapbox-marker';
export default Ember.Component.extend({
classNameBindings: ['isLoaded'],
layout: layout,
iconUrl: '',
iconUrl: '',
iconSize: [30, 45],
iconAnchor: [15, 45],
@planetexpress69
planetexpress69 / gist:bbe6e5f4f675c79aa0f2
Created December 23, 2015 09:31
FTP on CLI for simple deployment
#!/bin/bash
HOST="your.host.name"
USER="username"
PASS="pasword"
FTPURL="ftp://$USER:$PASS@$HOST"
LCD="/Users/martin/Desktop/emberplayground/oi/dist"
RCD="/"
#DELETE="--delete"
lftp -c "set ftp:list-options -a;
open '$FTPURL';
CURR=1
SUBNET="10.0.0"
while [ $CURR -lt 255 ] ; do
ping -c1 -t1 $SUBNET.$CURR 2>&1 >/dev/null
if [ "$?" -eq "0" ]; then
echo "$SUBNET.$CURR"
fi
let CURR=$CURR+1
done
@planetexpress69
planetexpress69 / bump.sh
Last active January 5, 2016 11:14
Ember project versioning
#!/bin/bash
if [ $# -eq 1 ]
then
version="$1"
echo "Bumping to version $version..."
npm version $version
git push --follow-tags
ember deploy production
exit 0
else