I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
| package com.darmasoft.parental_informant; | |
| import java.io.IOException; | |
| import java.net.InetAddress; | |
| import java.net.InetSocketAddress; | |
| import java.net.Socket; | |
| import java.net.UnknownHostException; | |
| import javax.net.ssl.SSLContext; | |
| import javax.net.ssl.SSLSocket; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| "use strict"; | |
| var crypto = require("crypto"); | |
| var EncryptionHelper = (function () { | |
| function getKeyAndIV(key, callback) { | |
| crypto.pseudoRandomBytes(16, function (err, ivBuffer) { | |
| var keyBuffer = (key instanceof Buffer) ? key : new Buffer(key) ; |
Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.
For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.
This gives an ongoing list of file-type magic numbers.
| # You must first install apktool (https://github.com/iBotPeaches/Apktool) and android SDK | |
| # and decompile apk using it | |
| # apktool d -rf my-app.apk | |
| # then generate a key for sign in: | |
| # keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 | |
| rm signed-app.apk | |
| apktool b -f -d com.myapp | |
| jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore com.myapp/dist/com.myapp.apk alias_name | |
| zipalign -v 4 com.myapp/dist/com.myapp.apk signed-app.apk |
| import Cocoa | |
| import Foundation | |
| var str = "Hello, playground" | |
| var task:NSTask = NSTask() | |
| var pipe:NSPipe = NSPipe() | |
| task.launchPath = "/bin/ls" | |
| task.arguments = ["-la"] |
| // To check if a number is between a range, don't do | |
| if number >=0 && number <= 100 { | |
| } | |
| // Use range and news operators instead : | |
| if 0...100 ~= number { | |
| } |
Editing /etc/passwd won't work in iOS, so in order to change default shell in iOS you need to edit /etc/master.passwd. You can change root's default shell to bash like this -- root:/smx7MYTQIi2M:0:0::0:0:System Administrator:/var/root:/bin/bash.