Skip to content

Instantly share code, notes, and snippets.

View junaidk's full-sized avatar

Junaid Khalid junaidk

  • Mirantis
  • Berlin
View GitHub Profile
@junaidk
junaidk / idea.md
Last active August 29, 2015 14:10
Intelli j idea shortcuts

These are some of my most used keyboard short cuts

  • Syntax aware selection in the editor selects a word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc.: Ctrl+W

  • Basic Code Completion, to complete methods, keywords etc.: Ctrl+Space

  • Go to Declaration. Use this to navigate to the declaration of a class, method or variable used somewhere in the code: Ctrl+B

  • Introduce Variable Refactoring, to create a variable from an expression. This expression may even be incomplete or contain errors. Since version 8, IDEA intelligently selects a likely expression when no text is selected: Ctrl+Alt+V

@junaidk
junaidk / signAndAlign.py
Created December 26, 2014 14:12
Sign and align multiple unaligned apks
# java and sdk tools should be on system path
# it needs zipalign and jarsigner tools
# http://developer.android.com/tools/publishing/app-signing.html
from subprocess import call
keyPass = ""
storepass = ""
alias = ""
keyStorePath = ""
@junaidk
junaidk / user.md
Last active August 29, 2015 14:12
create user linux

create a new user

create user and add in group
sudo useradd -G 1000 user
make directory for user
mkdir /home/user
TxnID UserID TimeStampe ItemID Quantity UnitPrice
1 4122 17-09-2011 1:25 47 34 52.48
2 273 17-09-2011 1:53 278 24 82.62
3 3305 17-09-2011 1:55 183 50 52.49
4 3561 17-09-2011 9:37 343 46 55.94
5 1477 17-09-2011 10:07 313 44 56.19
6 1850 17-09-2011 11:30 361 22 89.13
7 1532 17-09-2011 11:48 304 22 78.63
8 3055 17-09-2011 15:16 174 41 39.46
9 1176 17-09-2011 17:40 130 32 73.18
@junaidk
junaidk / gist:64ee1ef2677102101689
Last active September 9, 2015 13:40
.desktop file
[Desktop Entry]
Type=Application
Terminal=false
Name=Intellij Idea
Icon= path to icon
Exec= path to .sh file
-----------------
@junaidk
junaidk / Unix.sh
Last active October 31, 2015 15:01
count character in each line of a file
# if number of occurrences of " , " is > 5 print the number
tr -d -c ',\n' < Users.csv | awk '{ if ( length >= 5) {print length;} }'
# if number of occurrences of " , " is > 5 print line number
tr -d -c ',\n' < Users.csv | awk '{ if ( length >= 5) {print NR;} }'
# read nth line from file
awk ' NR == 5' Users.csv
@junaidk
junaidk / gist:5693223
Last active December 17, 2015 23:58
Cocos 2dx setup
##import into eclipse
(http://stackoverflow.com/questions/12654078/cocos2d-x-android-cant-resolved-coscos2dx-library)
In cocos2d-x 2.0.3 ...Cocos2d-x Lib java files has been considered as a different project only So import that project in the eclipse
Lets make it Simple
First Import the project in eclipse from this path - cocos2d-2.0-x-2.0.3/cocos2dx/platform/android/java
You will see libcocos2dx project in eclipse ...Keep this project open always otherwise your projects will give error on the syntax of library
Run create-android-project
@junaidk
junaidk / arrayShuffle.cpp
Last active December 18, 2015 02:48
Shuffle an array
// C Program to shuffle a given array
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// A utility function to swap to integers
void swap (int *a, int *b)
{
int temp = *a;
@junaidk
junaidk / gist:6131963
Created August 1, 2013 14:34
Cocos2dx action sequence -- call a function after an action completion
int *value = new int(3);
CCLog("*value = %d", *value); //=> I get 3 here => ok
_coinsLabel->runAction((CCSequence*)CCSequence::actions(
CCDelayTime::actionWithDuration(.05f),
CCCallFuncND::actionWithTarget(this, callfuncND_selector(GameLayer::addCoins),(void*) value),
NULL));
//function to called
void GameLayer::addCoins((CCNode* sender, void* data)
{
@junaidk
junaidk / gist:7674306
Created November 27, 2013 11:34
Matlab dragNdrop
%% define each of these functions in separate function files
%% with file name equal to function name
%1
function dropObject(hObject,eventdata)
global dragging ;
global orPos ;
global axisSize;
if ~isempty(dragging)