Skip to content

Instantly share code, notes, and snippets.

@dulacp
dulacp / Overlay_iOS_app_version_on_icon_README.md
Last active November 19, 2017 11:18
Overlay the iOS application version on top of the icon

Usage

Requirements

Install the two dependencies, ImageMagick and Ghostscript.

$ brew install imagemagick
$ brew install ghostscript
#include "Halide.h"
#include "Halide/tools/halide_image_io.h"
#include <iostream>
// This code calculates a block based mean on some a-priori known image-dimensions (1 uint8_t channel)
// An example image to process: http://i.imgur.com/Eyo0Xvc.png
// No customized scheduling within this code, but the SO-answer gives some recommendation!
int main(int argc, char **argv) {
Halide::Buffer<uint8_t> input = Halide::Tools::load_image("TestImages/block_example.png");
@natecook1000
natecook1000 / nshipster-new-years-2016.md
Last active July 10, 2018 19:24
NSHipster New Year's 2016

Greetings and salutations, NSHipsters!

As the year winds down, it's a tradition here at NSHipster to ask you, dear readers, to offer up your favorite tricks and tips from the past year as gifts to your fellow hipsters. With iOS 9, El Capitan, brand new watch- and tvOS's, and the open-sourcing of some minor Apple-related tech, there's bound to be lots to share.

Submit your favorite piece of Swift or @objc trivia, helpful hints, unexpected discoveries, useful workarounds, useless fascinations, or anything else you found cool this year. Just comment below!

If you need inspiration, try [the list from last year][2015], or [from the year before][2014], or [from the year before that][2013].

@nileshpunjabi
nileshpunjabi / rotate_video.m
Last active October 16, 2018 12:41
Rotate Landscape video
//setting up the first video based on previous recording
CMTimeRange videoDuration = CMTimeRangeMake(kCMTimeZero, [self.previousRecording duration]);
AVAssetTrack *clipVideoTrack = [[self.previousRecording tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
AVAssetTrack *clipAudioTrack = [[self.previousRecording tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
[compositionVideoTrack insertTimeRange:videoDuration ofTrack:clipVideoTrack atTime:nextClipStartTime error:nil];
[compositionAudioTrack insertTimeRange:videoDuration ofTrack:clipAudioTrack atTime:nextClipStartTime error:nil];
//our first track instruction - set up the instruction layer, then check the orientation of the track
//if the track is in landscape-left mode, it needs to be rotated 180 degrees (PI)
AVMutableVideoCompositionLayerInstruction *firstTrackInstruction =
@skabber
skabber / build_ota.sh
Created September 12, 2011 19:49
Xcode Build OTA
#!/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
@ksm
ksm / UINavigationController+Fade.h
Created February 14, 2012 22:23
UINavigationController custom pop/push transition animation
/*
Copied and pasted from David Hamrick's blog:
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html
*/
@interface UINavigationController (Fade)
- (void)pushFadeViewController:(UIViewController *)viewController;
- (void)fadePopViewController;
@tokestermw
tokestermw / rnn_viz_keras.py
Last active April 6, 2019 18:40
Recurrent Neural Network (RNN) visualizations using Keras.
from __future__ import print_function
from keras import backend as K
from keras.engine import Input, Model, InputSpec
from keras.layers import Dense, Activation, Dropout, Lambda
from keras.layers import Embedding, LSTM
from keras.optimizers import Adam
from keras.preprocessing import sequence
from keras.utils.data_utils import get_file
from keras.datasets import imdb
@cdnsteve
cdnsteve / gist:5396612
Last active April 4, 2020 11:46 — forked from jaredhanson/gist:2559730
Node.js: Restify and Passport for FB
// Based off example code from Hal Robertson
// https://github.com/halrobertson/test-restify-passport-facebook
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao
var restify = require('restify')
// config vars
var FB_LOGIN_PATH = '/api/facebook_login'
var FB_CALLBACK_PATH = '/api/facebook_callback'
var FB_APPID = '<<YOUR APPID HERE>>'
@figgis
figgis / Makefile
Last active April 8, 2020 08:15
ffmpeg qp values
# use pkg-config for getting CFLAGS and LDLIBS
FFMPEG_LIBS= libavdevice \
libavformat \
libavfilter \
libavcodec \
libswresample \
libswscale \
libavutil \
CFLAGS += -Wall -g
@wingedsheep
wingedsheep / evolution.py
Created June 19, 2016 11:35
Simple Neuroevolution Cartpole
# import os
# os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=gpu,floatX=float32"
# import theano
# import the neural net stuff
from keras.models import Sequential
from keras import optimizers
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution1D
from keras.layers.normalization import BatchNormalization