hexadev-blog
hexadev-blog
Hexa's Developments
65 posts
Don't wanna be here? Send us removal request.
hexadev-blog · 7 years ago
Text
Upload to FTP server using curl
find . -exec curl -T {} ftp://user:pass@some-ftp-site/folder/  \;
0 notes
hexadev-blog · 9 years ago
Text
Telegram Command Line
Source
https://github.com/vysheng/tg/
Another way to identify groups
chat_with_peer chat#1232322
chat_with_peer user#1231212
Useful flags
-N (enable numbering of messages)
-W (wait for dialog_list before starting)
1 note · View note
hexadev-blog · 9 years ago
Text
Persistent mount
Check drive names
fdisk -l
Edit /etc/fstab
/dev/sdb /mount/to/folder ntfs defaults 0 0
Mount the drive
mount -a
Network Drive
//192.168.1.1/Share /mnt/networkdrive cifs username=admin,password=pwd,iocharset=utf8,uid=1000,gid=1000,rw 0 0
0 notes
hexadev-blog · 9 years ago
Text
nano line x
Go to line x in nano,
nano +x filename
0 notes
hexadev-blog · 9 years ago
Text
MongoDB Drop All Collections
use [database]; db.dropDatabase();
0 notes
hexadev-blog · 9 years ago
Text
Parse DB Tips
Include multiple pointer in a query.
query.include([’pointer1′, ‘pointer2′]);
Chain equalTo
query.equalTo(’table1′, pointer1).equalTo(’table2′, pointer2)
Parse has its own Promises
return Parse.Promise.error(”Error Message”);
Take note of queries results, even if the length of the result is 1, it is still in an array.
4 notes · View notes
hexadev-blog · 9 years ago
Text
Paypal express checkout setup
A good walkthrough for payment process can be found here.
https://devtools-paypal.com/guide/expresscheckout/php
Setting up paypal express with nodejs (server side)
var request = require('request'); var querystring = require('querystring');
var data = { USER: "", // user id PWD: "", // password SIGNATURE: "", // signature VERSION: 95,  METHOD: "SetExpressCheckout", PAYMENTREQUEST_0_AMT: 123, // payment amount PAYMENTREQUEST_0_PAYMENTACTION: "SALE", // type of transaction PAYMENTREQUEST_0_CURRENCYCODE: "USD", // payment currency code returnUrl: "", // after payment cancelUrl: "" // cancel  }
request.post({url:'https://api-3t.sandbox.paypal.com/nvp', form: data}, function(err,httpResponse,body){ var redirectUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + querystring.parse(body).TOKEN; });
After payment is completed, paypal will redirect the user to ‘returnUrl’ with TOKEN and PAYERID. From there you can check the details of the payment.
var checkPayment = { USER: "", // user id PWD: "", // password SIGNATURE: "", // signature VERSION: 95, METHOD: "GetExpressCheckoutDetails", TOKEN: "" // the token you received }
request.post({url:'https://api-3t.sandbox.paypal.com/nvp', form: checkPayment}, function(err,httpResponse,body){ console.log(querystring.parse(body)); });
References:
https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleAuthPayment-curl-etc/
0 notes
hexadev-blog · 9 years ago
Text
Clear notifications in Blackboard
https://ntulearn.ntu.edu.sg/webapps/streamViewer/streamViewer?cmd=view&streamName=alerts&globalNavigation=false
var links = document.getElementsByTagName("a"); 
for(var i=0; i<links.length; i++) { 
   if(links[i].getAttribute("title") == "Dismiss")   console.log(links[i].click());
 }
0 notes
hexadev-blog · 9 years ago
Link
iOS production, development management flow
3 notes · View notes
hexadev-blog · 9 years ago
Text
Setting up Theos on Cygwin
Platform: Windows  iOS 8.4
Install these on Cygwin 
- wget, git, ca-certificates, make, perl, openssh
run these commands in cygwin
git clone https://github.com/coolstar/theos.git && mkdir -p theos/toolchain/windows
git clone -b x86_64 https://github.com/coolstar/iOSToolchain4Win.git theos/toolchain/windows/iphone
Download sdk and extract to theos/sdks
wget http://iphone.howett.net/sdks/dl/iPhoneOS8.1.sdk.tbz2
tar xvf iPhoneOS8.1.sdk.tbz2
Update libsubstrate.dylib for arm64
wget http://cdn.hbang.ws/dl/libsubstrate_arm64.dylib
overwrite the one in /theos/lib/libsubstrate.dylib
Makefile
ARCHS := armv7 arm64 TARGET := iphone:clang TARGET_SDK_VERSION := 8.1
Useful for reversing
logify.pl SomeClassHeader.h > tweak.xm
References:
http://sharedinstance.net/2013/12/how-to-support-arm64/
1 note · View note
hexadev-blog · 10 years ago
Text
Integrating Unity3d Into iOS UITabBarController / UINavigationController
Assuming you integrated unity with your project and there is no compiling errors. There are 3 files you have to modify in order to get this to work. I’m using Unity v5.0.0f4 and XCode 6.3.1. There are quite some changes in Unity’s v5 and v4. One main change is the createHierarchy is deprecated and you will have to use willStartWithViewController.
[main.mm]
In the main function inside main.mm file, edit with the extended “UnityAppController” class.  
  UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:AppControllerClassName]);
[YourUnityAppController.mm] 
This is the file where you create in unity under Plugin/iOS/YourUnityAppController.mm 
This initializes the rootController and rootView used by Unity. We will not do anything else here.
- (void)willStartWithViewController:(UIViewController*)controller {
   _rootController = [[UIViewController alloc] init];
   _rootView       = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
}
In your didFinishLaunchingWithOptions method create an observer. We will need to use this to listen when Unity is being created completely and then set our windows rootView with anything we want.
The process is as follow
- didFinishLaunchingWithOptions will call its super class which will invoke “willStartWithViewController”. Which means anything below the super class constructor will be invoked after “willStartWithViewController” is finished. 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUnityReady) name:@"UnityReady" object:self];
   [super application:application didFinishLaunchingWithOptions:launchOptions]
}
And our method to handle the observer.
- (void)handleUnityReady {
   _window.rootViewController = yourTabBarController;
}
This prevents Unity from overriding your view with its view when the app launches.
[UnityAppController.mm]
Inside this file locate startUnity function. We will need to add our callback in there. Make sure it is added after [self showGameUI]
   [[NSNotificationCenter defaultCenter] postNotificationName:@"UnityReady" object:self];
That is it! The Unity view is being created but not on top of your application. You can then grab the Unity view using GetAppController().unityView and assign it to any view you want.
http://stackoverflow.com/questions/30801845/integrating-unity3d-into-ios-uitabbarcontroller-uinavigationcontroller
0 notes
hexadev-blog · 10 years ago
Text
Dynamically Creating UITable with CustomCell
   tblUpdates.delegate = self;
   tblUpdates.dataSource = self;
   [tblUpdates registerClass:[CustomCell class] forCellReuseIdentifier:@"CustomCell"];
0 notes
hexadev-blog · 11 years ago
Link
1 note · View note
hexadev-blog · 11 years ago
Text
MongoDB start server
sudo rm /var/lib/mongodb/mongod.lock mongod --repair sudo service mongodb start
0 notes
hexadev-blog · 11 years ago
Link
0 notes
hexadev-blog · 11 years ago
Link
Play sound from JavaScript including MP3, MPEG-4 and HTML5-supported audio formats with SoundManager 2, a cross-browser/platform sound API. BSD licensed.
1 note · View note
hexadev-blog · 11 years ago
Text
Sailsjs raw socket.io
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
  var socket = req.socket;
var io = sails.io;
  // emit to all sockets (aka publish)
// including yourself
io.sockets.emit('messageName', {thisIs: 'theMessage'});
  // broadcast to a room (aka publish)
// excluding yourself, if you're in it
socket.broadcast.to('roomName').emit('messageName', {thisIs: 'theMessage'});
  // emit to a room (aka publish)
// including yourself
io.sockets.in('roomName').emit('messageName', {thisIs: 'theMessage'});
  // Join a room (aka subscribe)
// If you're in the room already, no problem, do nothing
// If the room doesn't exist yet, it gets created
socket.join('roomName');
  // Leave a room (aka unsubscribe)
// If you're not in the room, no problem, do nothing
// If the room doesn't exist yet, no problem, do nothing
socket.leave('roomName');
  // Get all connected sockets in the app
sails.io.sockets.clients();
  // Get all conneted sockets in the room, "roomName"
sails.io.sockets.clients('roomName');
    }
};
https://gist.github.com/mikermcneil/6598661
0 notes