The current one is hard. I will not include link to certificate since the challenge is not completed yet and solution can be viewed from link in the certificate.
The previous one is easier. Challenge and solution can be viewed by link in certificate.
https://app.codility.com/cert/view/certQ65CZN-VDK7QY36D8EJ7R7B/
Quick tips or notes that probably reflects 20 percent of knowledge that usually does 80 percent of job.
Friday, May 11, 2018
Saturday, January 13, 2018
Delete Healthy Recovery Partition on Windows 10
I wanted to expand a disk partition, but the free space was blocked by a small Healthy recovery partition, which could not be deleted by graphical Disk Management utility. A few search reveals diskpart Windows utility is a rescuer.
This is a link to original post. Below is a reference for my future use.
This is a link to original post. Below is a reference for my future use.
1. Open a command prompt as administrator.
2. Run Diskpart application by typing diskpart in the command prompt.
3. In the “diskpart” prompt, enter rescan command and press Enter key to re-scan all partitions, volumes and drives available.
4. Then type in list disk and press Enter key to show all hard disk drive available.
5. Select the disk that contains the partition you want to remove. Normally, with just 1 hard disk, it will be disk 0. So the command will be:
Select disk 0
Finish by Enter key.
6. Type list partition and press Enter key to show all available and created partition in the disk selected.
7. Select the partition that wanted to be deleted by using the following command, followed by Enter key:
Select partition x
Where x is the number of the recovery partition to be removed and unlocked its space. Be careful with the number of this partition, as wrong number may get data wipes off.
8. Finally, type in delete partition override and press Enter key.
Wednesday, January 10, 2018
Shell: Check if symbolic link
This function checks if given path has symbolic link within it.
checkSymbolicLink()
{
if [ ! -d $1 ]; then
return 1
fi
pushd $1 1>/dev/null
cdir=$(pwd)
while [ $cdir != '/' ]
do
if [ -h $cdir ]
then
return 0
fi
cd .. 1>/dev/null
cdir=$(pwd)
done
popd 1>/dev/null
return 1
}
checkSymbolicLink()
{
if [ ! -d $1 ]; then
return 1
fi
pushd $1 1>/dev/null
cdir=$(pwd)
while [ $cdir != '/' ]
do
if [ -h $cdir ]
then
return 0
fi
cd .. 1>/dev/null
cdir=$(pwd)
done
popd 1>/dev/null
return 1
}
To get real path, whether the path is real of symbolic, use realpath command.
Friday, January 05, 2018
A Note on .ssh folder
When I made a not wise decision to change /root and its content as fully accessible to other users while still logging in as root user, the other users were refused to log in as root through ssh. They could log in back after I revoked the write permission on /root folder.
Checking the /var/log/secure, it said
xx sshd[xxx]: Authentication refused: bad ownership or modes for directory /root
Based on this, further google search reveals .ssh folder does not like to be writable by group users.
Here is a suggestion to .ssh folder to make sure the access to it is mostly limited to owner itself:
Checking the /var/log/secure, it said
xx sshd[xxx]: Authentication refused: bad ownership or modes for directory /root
Based on this, further google search reveals .ssh folder does not like to be writable by group users.
Here is a suggestion to .ssh folder to make sure the access to it is mostly limited to owner itself:
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
Tuesday, November 14, 2017
Amazon's solutions to What I've being doing
Green grass is what Predix.io has been doing, edge to cloud, digital twin etc.
http://www.allthingsdistributed.com/2017/06/unlocking-value-device-data-aws-greengrass.html
Glue is my work of data management workbench in Bitstew.
http://docs.aws.amazon.com/glue/latest/dg/what-is-glue.html
It's a little scary when I first learned this. They are so similar and Amazon is so influential and I worried they will surpass us.
At the end of day, I convinced myself that at least what I have been doing is cutting edge technologies and I want to do harder to make it better than Amazon's.
http://www.allthingsdistributed.com/2017/06/unlocking-value-device-data-aws-greengrass.html
Glue is my work of data management workbench in Bitstew.
http://docs.aws.amazon.com/glue/latest/dg/what-is-glue.html
It's a little scary when I first learned this. They are so similar and Amazon is so influential and I worried they will surpass us.
At the end of day, I convinced myself that at least what I have been doing is cutting edge technologies and I want to do harder to make it better than Amazon's.
Thursday, August 17, 2017
Weird IT Conventions (draft)
Frankly, for many of these so called conventions, I just want to swear. They just got your mind so twisted, so unsure about their meanings and so much more to remember.
Where to start? how about foo? foo... let's forget about it, I will never make up some examples with this name.
1. Parameter names of command line tools.
- usually is short form of it. -- is full form of it.
for example, -a is same as --attributes if a parameter is called attributes.
2. single and double quotes. ' and "
In many circumstances, these two a interchangeable, You can use 'xxx"xxx' to have a double quote in result string, or you can use "xxx'xxx" to have a single quote in your result string.
But in Unix world, single quote means everything within it is as is. Double quote means pretty much same thing, but with exceptions, except $, \ and !, which can have special meaning and allow something such as substitute a variable with its value.
This is a scenario that same symbol has different meanings in several popular coding environment, which gives you hard time by paying special attention to them.
Where to start? how about foo? foo... let's forget about it, I will never make up some examples with this name.
1. Parameter names of command line tools.
- usually is short form of it. -- is full form of it.
for example, -a is same as --attributes if a parameter is called attributes.
2. single and double quotes. ' and "
In many circumstances, these two a interchangeable, You can use 'xxx"xxx' to have a double quote in result string, or you can use "xxx'xxx" to have a single quote in your result string.
But in Unix world, single quote means everything within it is as is. Double quote means pretty much same thing, but with exceptions, except $, \ and !, which can have special meaning and allow something such as substitute a variable with its value.
This is a scenario that same symbol has different meanings in several popular coding environment, which gives you hard time by paying special attention to them.
Thursday, July 13, 2017
OAuth2 Notes
very hard to understand if you just check it from different web sources: people simply had wrong understanding or assumption on it.
OAuth:
it is not authentication nor authorization, it is about delegation protocol that is scalable.
I delegate access to someone to do something for me.
Client id: client should be registered with oauth server the first. along its id, usually there is a redirect_uri.
redirect_uri: is uased to verify the request is valid, and used to send authentication code back if the app is a web application.
access token: like session. used for secured api calls
refresh token: like a password to get new access token.
by reference token: reference is stored somewhere, it will convert reference to by value token for accessing apis
by value token: token will full information.
bearer token: like cash, when you spend it, no body ask for identification
holder of key token: like credit card. asking for identification. not shared by other users.
id token is for client to build a meaningful session between its client app and server app.
access token is meant for apis.
four roles:
user/me, client/application, authorization server/oauth server, resource server/where api or data is
steps:typical scenario
--client asks authorization erver for accessing resources on resource server,
--authorization server says sure if user agreed. it redirect client to user login page
--user signs in authorizatoin to complete authorization. once the authenticcation is successful, authorization server issues an authentication code to client app via redirect_uri.
--client app uses authentication code, its clilent id, and secrect to ask for an access token.
--client app now uses access token to access resources owned by user/on behalf of user.
--resource server can call authorization server to check if the token is valid. usually it does not need to and it simply check if the signature is trustable.
--resource server then provides resources to client app if token is valid.
it usually works with openid. after user logging in, the authorization server also returns id token that contains information about the user.
client app(server end) uses this id token to build an user session between client app's client and server.
in microservice, let each service understand JWT. and pass around JWT when it needs to call out for other services.
ID token is JWT token, JWT can also be access token.
token can expire, usually a refresh token is given at same time for client app to renew access token.
about exchanging token.
https://www.youtube.com/watch?v=1ZX7554l8hY
token has access scope
access token can be in bearer header, query string or payload, depending on oauth provider.
Client:
confidential client: web server etc
public client: model app, javascript in useragent etc
grant type:
two legged:
client credentials: accessing own resources.
you provie client id and client secret/password to get access token.
usually used on server side since it is OK when you can hide the client secret in server side configuration or code.
resource owner credentials:
this is user strongly trust client app, and give out its own user and password to client app.
implicit:usually in javascript code
https://tools.ietf.org/html/rfc6749#section-4.2
It is designed for applications that access APIs only while the user is present at the application
client app directs user to auth server to express authentication
oauth server redirect res owner back to client app along with access token
client app uses access token to access res user's resources on behalf of user
it does not have refresh token since the client app is not authenticated.it was driven directly by user himself.
(authentication code is for server that is proxy of user.)
since access token is viewiable to user on same computer, it's required to be passed only within secured transport.
redirect_uri is defined as part of client login in oauth server, it includes redirect_uri as optional configuration. redirect_uri is
a mean of verification in implicit grant, not a mean of communication. but it is mean of communication in authentication code grant.
three-legged:
authentication code: accessing other's resources
OAuth:
it is not authentication nor authorization, it is about delegation protocol that is scalable.
I delegate access to someone to do something for me.
Client id: client should be registered with oauth server the first. along its id, usually there is a redirect_uri.
redirect_uri: is uased to verify the request is valid, and used to send authentication code back if the app is a web application.
access token: like session. used for secured api calls
refresh token: like a password to get new access token.
by reference token: reference is stored somewhere, it will convert reference to by value token for accessing apis
by value token: token will full information.
bearer token: like cash, when you spend it, no body ask for identification
holder of key token: like credit card. asking for identification. not shared by other users.
id token is for client to build a meaningful session between its client app and server app.
access token is meant for apis.
four roles:
user/me, client/application, authorization server/oauth server, resource server/where api or data is
steps:typical scenario
--client asks authorization erver for accessing resources on resource server,
--authorization server says sure if user agreed. it redirect client to user login page
--user signs in authorizatoin to complete authorization. once the authenticcation is successful, authorization server issues an authentication code to client app via redirect_uri.
--client app uses authentication code, its clilent id, and secrect to ask for an access token.
--client app now uses access token to access resources owned by user/on behalf of user.
--resource server can call authorization server to check if the token is valid. usually it does not need to and it simply check if the signature is trustable.
--resource server then provides resources to client app if token is valid.
it usually works with openid. after user logging in, the authorization server also returns id token that contains information about the user.
client app(server end) uses this id token to build an user session between client app's client and server.
in microservice, let each service understand JWT. and pass around JWT when it needs to call out for other services.
ID token is JWT token, JWT can also be access token.
token can expire, usually a refresh token is given at same time for client app to renew access token.
about exchanging token.
https://www.youtube.com/watch?v=1ZX7554l8hY
token has access scope
access token can be in bearer header, query string or payload, depending on oauth provider.
Client:
confidential client: web server etc
public client: model app, javascript in useragent etc
grant type:
two legged:
client credentials: accessing own resources.
you provie client id and client secret/password to get access token.
usually used on server side since it is OK when you can hide the client secret in server side configuration or code.
resource owner credentials:
this is user strongly trust client app, and give out its own user and password to client app.
implicit:usually in javascript code
https://tools.ietf.org/html/rfc6749#section-4.2
It is designed for applications that access APIs only while the user is present at the application
client app directs user to auth server to express authentication
oauth server redirect res owner back to client app along with access token
client app uses access token to access res user's resources on behalf of user
it does not have refresh token since the client app is not authenticated.it was driven directly by user himself.
(authentication code is for server that is proxy of user.)
since access token is viewiable to user on same computer, it's required to be passed only within secured transport.
redirect_uri is defined as part of client login in oauth server, it includes redirect_uri as optional configuration. redirect_uri is
a mean of verification in implicit grant, not a mean of communication. but it is mean of communication in authentication code grant.
three-legged:
authentication code: accessing other's resources
Subscribe to:
Posts (Atom)