This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
variable=$1 | |
if [ $variable -lt 0 ]; then | |
echo Variable is less than 0 | |
elif [ $variable -eq 0 ]; then | |
echo Variable is equal to 0 | |
elif [ $variable -gt 0 ]; then | |
echo Variable is greater than 0 |
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Logical expression, Meaning | |
String comparion, | |
if [ -n "$variable" ], Returns true if the variable is empty/null | |
if [ -z "$variable" ], Returns true if the variable is not empty/null | |
if [ "$variable1" = "$variable2" ], Returns true if variable 1 is equal to variable 2 | |
if [ "$variable1" == "$variable2" ], Returns true if variable 1 is equal to variable 2 | |
if [ "$variable1" != "$variable2" ], Returns true if variable 1 is not equal to variable 2 | |
if [ "$variable1" \< "$variable2" ], Returns true if variable 1 is less than variable 2 in ASCII. The < is escaped (\<) | |
if [ "$variable1" \> "$variable2" ], Returns true if variable 1 is greater than variable 2 in ASCII. | |
Integer comparison, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ logical expression ]; then | |
statement 1 | |
statement 2 | |
elif [ logical expression ]; then | |
statement 3 | |
statement 4 | |
elif [ logical expression ]; then | |
statement 4 | |
statement 5 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ logical expression ] | |
then | |
statement 1 | |
statement 2 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ logical expression ]; then | |
statement 1 | |
statement 2 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ logical expression ]; then | |
statement 1 | |
statement 2 | |
else | |
statement 3 | |
statement 4 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
unsigned int invert(unsigned int x, int p, int n); | |
int main() | |
{ | |
unsigned int x; | |
unsigned int y; | |
unsigned int z; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl s_client -connect www.cmu.edu:443 -tls1 -servername www.cmu.edu | openssl x509 -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('Compute d') | |
x = filter(lambda x: x*3 % 160 == 1, range(1,1000)) | |
for i in x: | |
print(i) | |
print('\nEncryption') | |
enc_msg = pow(5,3) % 187 | |
print(enc_msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.http.HttpEntity; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.entity.ContentType; | |
import org.apache.http.entity.mime.HttpMultipartMode; | |
import org.apache.http.entity.mime.MultipartEntityBuilder; | |
import org.apache.http.impl.client.HttpClientBuilder; | |
import org.json.JSONObject; |