Skip to content

Instantly share code, notes, and snippets.

@vseow
vseow / apm-uninstall.sh
Created Nov 10, 2015
Uninstall multiple packages from Atom editor in the command line
View apm-uninstall.sh
apm list -b | grep [KEYWORD] | xargs apm uninstall
@vseow
vseow / wget.sh
Created Nov 10, 2015
Download from multiple links/URLs in a text file with wget
View wget.sh
wget --content-disposition -i list-of-links.txt
# Make sure your URLs are in the following format: http://www.example.com
@vseow
vseow / mongorestore.sh
Created Aug 7, 2015
Run mongorestore on Remote Target
View mongorestore.sh
mongorestore --host [IP/HOSTNAME] --port [PORT] --db [DB_NAME] --username [USER] --password [PASS] --collection [COLLECTION_NAME] dump/db/col.bson
@vseow
vseow / index.php
Last active Mar 25, 2018
Get Country from IP with PHP
View index.php
<?php
$ip = $_SERVER['REMOTE_ADDR'];
//echo $ip;
// Docs: http://ip-api.com/docs/
// Capped at 250 lookups/min - can unban yourself if you go over http://ip-api.com/docs/unban
$xml = simplexml_load_file("http://ip-api.com/xml/".$ip);
echo $xml->country;
@vseow
vseow / .gitignore
Created Aug 7, 2015
.gitignore for Xcode 6
View .gitignore
# Xcode
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
@vseow
vseow / update.php
Created Aug 7, 2015
Update Beacon Info with PHP (Kontakt)
View update.php
<?php
$url = 'https://api.kontakt.io/beacon/update?uniqueId=';
$prox = 'f7826da6-4fa2-4e98-8024-bc5b71e0893e'; // Example UUID
$did = 'lsuVg'; // Example Device ID, Unique ID
$alias = 'Example';
$privKey = 'insert-your-api-key-here';
@vseow
vseow / get.php
Created Aug 7, 2015
Get Beacon Info with PHP (Kontakt)
View get.php
<?php
$url = 'https://api.kontakt.io/beacon?proximity=';
$prox = 'f7826da6-4fa2-4e98-8024-bc5b71e0893e'; // Example UUID
$major = '37579';
$minor = '51992';
$privKey = 'insert-your-api-key-here';
@vseow
vseow / badge.m
Created Aug 7, 2015
Set Badge Notification Number on App Icon (iOS)
View badge.m
- (void)application:(UIApplication *)application didReceiveRemoteNotification: (NSDictionary *)userInfo {
NSLog(@"userInfo:%@",userInfo);
badge_value+=[[[userInfo objectForKey:@"aps"] objectForKey:@"badge"]intValue];
NSLog(@"Total badge Value:%d",badge_value);
for (id key in userInfo) {
NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
}
@vseow
vseow / s3cmd_sync.sh
Created Aug 7, 2015
Backing Up to Amazon S3
View s3cmd_sync.sh
# Command Line to run from terminal
# Logs result to file s3_backup.log
# Command will run in the background
s3cmd sync -v /path/to/folder/ s3://s3-bucket/folder/ > s3_backup.log 2>&1 &
# Crontab command to sync folder to S3
# Command will run 1am every day and logs result to /root/s3_backup.log
0 1 * * * /usr/bin/s3cmd sync -rv /path/to/folder/ s3://s3-bucket/folder/ >> /root/s3_backup.log
@vseow
vseow / getVendorID.m
Created Aug 7, 2015
Get Vendor ID iOS
View getVendorID.m
NSString *udid;
udid = [UIDevice currentDevice].identifierForVendor.UUIDString;
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.