Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* qtfaststart.php v0.1 by Valentin Schmidt
* based on qt-faststart.c v0.2 by Mike Melanson (melanson@pcisys.net)
*
* This file is placed in the public domain. Use the program however you
* see fit.
*
* This utility rearranges a Quicktime file such that the moov atom
* is in front of the data, thus facilitating network streaming.
@newbdez33
newbdez33 / AmazonProduct.swift
Created June 19, 2017 02:16 — forked from coryalder/AmazonProduct.swift
Amazon Product Advertising API + Alamofire
//
// AmazonProduct.swift
// Requires SHXMLParser for parsing Amazon's XML responses (https://github.com/simhanature/SHXMLParser)
//
// Created by Cory Alder on 2015-01-11.
// Copyright (c) 2015 Davander Mobile Corporation. All rights reserved.
//
// partly inspired by RWMAmazonProductAdvertisingManager
import Alamofire
@newbdez33
newbdez33 / SmartSpeed.swift
Created June 13, 2017 16:02 — forked from tonnylitao/SmartSpeed.swift
Smart Speed like Overcast. Smart Speed means shorten the silence of audio for saving time.
do {
try audioPlayer = AVAudioPlayer(contentsOf: url)
audioPlayer.isMeteringEnabled = true
audioPlayer.enableRate = true
audioPlayer.prepareToPlay()
} catch let error as NSError {
print("audioPlayer error \(error.localizedDescription)")
}
audioPlayer.play()

UICollectionView Simple Template

import UIKit

class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
    
    @IBOutlet weak var collectionView: UICollectionView!
    
    override func viewDidLoad() {
@newbdez33
newbdez33 / vpnserver.sh
Created January 3, 2017 01:11 — forked from kevinzhow/vpnserver.sh
OnClickVPNServer
#!/usr/bin/env bash
echo 'deb http://shadowsocks.org/debian wheezy main' >> /etc/apt/sources.list
# Pre-requisites
sudo apt-get -y update
sudo apt-get -y install pptpd
sudo apt-get -y install fail2ban
sudo apt-get -y install shadowsocks-libev
@newbdez33
newbdez33 / gist:86d3dc1cc55e5cfbacba
Created March 14, 2016 08:22 — forked from dopa/gist:5245868
Shell Script to Back Up all MySQL Databases, Keep 7 Days of Backups
#!/bin/bash
# Script will output dumps for all databases using seperate files
# Derived from this post: http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
USER="root"
PASSWORD="SnM1073k"
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR="/backups/files"
@newbdez33
newbdez33 / API.md
Last active August 29, 2015 14:17 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
+ (NSString *) platform;
@newbdez33
newbdez33 / setup.sh
Last active August 29, 2015 14:02 — forked from boo1ean/setup.sh
#!/usr/bin/env bash
# Install dependencies
yum update -y
yum install -y gcc apr-devel apr-util-devel openssl-devel pcre-devel libxml2-devel libcurl-devel
mkdir setup && cd setup
wget http://apache.mirrors.pair.com//httpd/httpd-2.4.9.tar.gz
tar -xvf httpd-2.4.9.tar.gz
- (MyCustomObject *)getObject {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSData *MyCustomObjectEncodedObject = [defaults objectForKey:kMyCustomObjectKEY];
MyCustomObject *MyCustomObject = (MyCustomObject *)[NSKeyedUnarchiver unarchiveObjectWithData: MyCustomObjectEncodedObject];
return MyCustomObject;
}
- (void)setMyCustomObject:(MyCustomObject *)MyCustomObject {
NSData *MyCustomObjectEncodedObject = [NSKeyedArchiver archivedDataWithRootObject:MyCustomObject];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];