Skip to content

Instantly share code, notes, and snippets.

@agniswarm
agniswarm / request.js
Created September 22, 2018 08:01
Turn requestjs into a async and await style function
import request from 'request';
async function requested(params: any) {
let promise = await new Promise<any>((resolve, reject) => {
request(params, (err: any, res: any, body: any) => {
if (err || res.statusCode != 200)
reject(err)
else
resolve(body);
})
@agniswarm
agniswarm / isPrime.js
Created August 15, 2018 13:13
Prime Number
function isPrime(n) {
let counter = 0;
if (n == 2) return true;
if (n % 2 == 0 || n == 1) return false;
for (let i = 1; i <= n / 2; i += 2) {
if (n % i == 0)
counter++;
if (counter == 2)
break;
}
@agniswarm
agniswarm / openssl.md
Created July 29, 2018 20:40 — forked from NoMan2000/openssl.md
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

SSL Info

Generate RSA private key with certificate in a single command

openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar

Generate Certificate Signing Request (CSR) from private key with passphrase

openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar

@agniswarm
agniswarm / openssl.txt
Created July 29, 2018 20:34
OPENSSL Commands
openssl genrsa -out ca.key 4096
openssl req -new -x509 -days 1826 -key ca.key -out ca.crt
openssl genrsa -out ia.key 4096
openssl req -new -key ia.key -out ia.csr
openssl x509 -req -days 730 -in ia.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out ia.crt
openssl pkcs12 -export -out ia.p12 -inkey ia.key -in ia.crt -chain -CAfile ca.crt
source : https://goo.gl/m2aW9p
@agniswarm
agniswarm / settings.json
Created July 28, 2018 20:18
Gist for VS code setting for typescript
{
"editor.formatOnSave": true,
"files.exclude": {
"*.js": true,
"*.js.map": true,
"ServerLocal": true
}
}
@agniswarm
agniswarm / GitHelp.txt
Created July 21, 2018 19:13
Git Related Help
To undo Commits on github
1. Uncommit the commits using using VS Code
2. use this Cli Command 'git push origin +branchName'
@agniswarm
agniswarm / c_cpp_properties.json
Last active July 20, 2018 18:12
The VS code config file for C++
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/MinGW/**"
],
"defines": [
"_DEBUG",