Skip to content

Instantly share code, notes, and snippets.

View david90's full-sized avatar
😛

David Ng david90

😛
View GitHub Profile
@david90
david90 / CopyPublicKey
Created June 25, 2014 06:42
Copy Public Key
pbcopy < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
@david90
david90 / sshTunnel
Created June 25, 2014 11:42
SSH Tunnel
ssh -D 8080 -C -N username@example.com
@david90
david90 / compareVersion.mm
Created July 8, 2014 09:52
Compare Version String in iOS
- (BOOL) isVersion:(NSString *)thisVersionString higherThan:(NSString *)thatVersionString {
// LOWER
if ([thisVersionString compare:thatVersionString options:NSNumericSearch] == NSOrderedAscending) {
NSLog(@"%@ < %@", thisVersionString, thatVersionString);
return NO;
}
// EQUAL
if ([thisVersionString compare:thatVersionString options:NSNumericSearch] == NSOrderedSame) {

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@david90
david90 / gist:92e87125154dd268351b
Created July 7, 2015 07:10
Regex to block spam referral in google analytics
(semalt\.semalt\.com|buttons-for-website\.com|best-seo-offer\.com|buttons-for-your-website\.com|100dollars-seo\.com|www\.event-tracking\.com|floating-share-buttons\.com|free-social-buttons\.com|www\.Get-Free-Traffic-Now\.com)
@david90
david90 / skip_extension
Created July 8, 2015 06:57
Check not in extension
#if !(defined(__has_feature) && __has_feature(attribute_availability_app_extension))
// some [UIApplication sharedApplication] code
#endif
@david90
david90 / resizer.sh
Last active February 2, 2023 10:08 — forked from benvium/resizer.txt
#!/bin/bash -e
# Make sure you have installed ImageMagick
# http://cactuslab.com/imagemagick/
# Ensure we're running in location of script.
cd "`dirname $0`"
for f in *; do
if [[ $f == *@3x* ]];
then
@david90
david90 / app_metrics.js
Created August 6, 2015 09:13
Simple Event tracking Server that insert records to MySQL (express, mysql module needed)
/* Server monitor */
// require('newrelic');
var mysql = require('mysql');
var express = require('express');
var app = express();
var eventsCollection;
var sessionsCollection;
/** MySQL Settings **/
@david90
david90 / skygear-cms-readme.md
Last active January 18, 2017 09:12
Skygear CMS - README

CMS Plugin for Skygear

This is a Skygear Plugin to provide CMS functionality to your app.

Installation

It is easy to use CMS in your Skygear app on the cloud. To do that, add the following line in your index.js in the root of your repo:

@david90
david90 / extracting_inception.py
Created February 14, 2017 09:06
Code for extracting inception bottleneck feature
import os
import tensorflow as tf
import tensorflow.python.platform
from tensorflow.python.platform import gfile
import numpy as np
def create_graph(model_path):
"""
create_graph loads the inception model to memory, should be called before
calling extract_features.