Skip to content

Instantly share code, notes, and snippets.

@newbdez33
newbdez33 / fileurl.php
Created November 13, 2012 08:31 — forked from millsy/fileurl.php
amazon s3 php get url of file
<?php
require_once 'sdk.class.php';
$s3 = new AmazonS3();
$s3url = $s3->get_object_url('mybucket', 'mypath/tofile.txt', '5 minutes');
echo $s3url;
?>
@newbdez33
newbdez33 / s3upload.php
Created November 26, 2012 01:08
amazon s3 get file size/change content type (v1/v2)
//3. Deal with s3/file map
/*use Aws\Common\Aws;
use Aws\Common\Enum\Region;
$aws = Aws::factory(array(
'key' => AWS_ACCESS_KEY,
'secret' => AWS_SECRET_ACCESS_KEY,
'region' => Region::US_EAST_1,
'scheme' => 'http' //https will fail, WTF??!
));
@newbdez33
newbdez33 / get_file_extension.php
Last active December 11, 2015 02:09
get file extension php
<?php
$path = 'abc.jpeg';
$ext = pathinfo($path,PATHINFO_EXTENSION);
echo $ext;
- (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];
{
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
//[DummyAssetsImporter importAssets:assets];
});
}
@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
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
+ (NSString *) platform;
@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:

@newbdez33
newbdez33 / cheasing-api.md
Last active August 29, 2015 14:17
追逐营销API

获得所有用户点信息

返回符合条件的所有用户JSON数据

  • URL

    /nodes

  • Method:

@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"