Skip to content

Instantly share code, notes, and snippets.

View niradler's full-sized avatar
🎮

Nir Adler niradler

🎮
View GitHub Profile
@niradler
niradler / After_Installing_Kali.sh
Created May 5, 2019 20:28
The Top 10 Things to Do After Installing Kali Linux on Your Computer
# update & upgrade
sudo apt update && apt upgrade
# create user
adduser <username>
# install packages
apt install tilix maltego metasploit-framework burpsuite wireshark aircrack-ng hydra nmap beef-xss nikto
# install tor
@niradler
niradler / resolve_promises_sequentially.js
Created May 1, 2019 11:38
resolve promises sequentially with reduce.
function resolveSequentially(promisesArray) {
return promisesArray.reduce((accumulatorPromise, promise) => {
return accumulatorPromise
.then(() => {
return promise;
})
}, Promise.resolve());
}
@niradler
niradler / bash_arguments .sh
Created April 29, 2019 09:58
How to parse command line arguments using Bash case statements
#!/bin/bash
echo "Starting sctipt $0"
display_usage() {
echo
echo "Usage: $0"
echo
echo " -h, --help Display usage instructions"
echo " -p, --print Print welcome message"
echo
}
@niradler
niradler / create_code_template.sh
Created April 29, 2019 09:56
Make Your Own React CLI with Bash
# ~/code_templates/component.js
import React from 'react';
import './COMPONENT_NAME.scss';
function COMPONENT_NAME() {
return <div>Hello</div>;
}
export default COMPONENT_NAME;
@niradler
niradler / apigateway export
Created April 22, 2019 23:28
export docs from apigateway
//https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/APIGateway.html#getExport-property
const fs = require("fs");
const AWS = require("aws-sdk");
const path = require("path");
const apigateway = new AWS.APIGateway({
apiVersion: "2015-07-09",
region: "us-east-1"
});
const getExport = params => {
@niradler
niradler / serverless-policy.json
Created April 16, 2019 14:14
serverless policy for aws sort by resource type.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "edit0",
"Effect": "Allow",
"Action": [
"lambda:CreateFunction",
"lambda:List*",
"lambda:Get*",
mkdir -p src/components/$1
touch src/components/$1/$1.scss
sed -e "s/COMPONENT_NAME/$1/g" ~/code_templates/component.js > src/components/$1/index.js
@niradler
niradler / bash_profile
Created December 26, 2018 15:22
add alias mac sudo nano ~/.bash_profile
alias l='ls -lah'
alias gac='git add . && git commit -am'
alias gi='git init && gac "init"'
alias gc='git checkout'
alias glo='git pull origin'
alias gd='gc develop && glo develop && gc master && glo master && git merge develop && git push'
alias prt='prettier --write ./*.js'
@niradler
niradler / elastic_stack.sh
Created December 22, 2018 14:25
elastic stack installation on ubuntu
# https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04
# https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04
# https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-18-04#installing-the-oracle-jdk
# https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-18-04
# install nginx
sudo apt update
sudo apt install nginx
sudo ufw app list
@niradler
niradler / Export-all-apigateway.sh
Last active December 5, 2018 18:43
export all aws api gateway endpoint.
#for dev and prod stage, dont forget to install jq
aws apigateway get-rest-apis | jq '.items[].id' | sed s/\"// | sed s/\”// > api_ids.txt
for i in $(cat api_ids.txt);
do aws apigateway get-export --parameters extensions='postman' --rest-api-id $i --stage-name prod --export-type swagger ./apis/lambda/prod/$i.json;
echo $i ;
done ;
for i in $(cat api_ids.txt);
do aws apigateway get-export --parameters extensions='postman' --rest-api-id $i --stage-name dev --export-type swagger ./apis/lambda/dev/$i.json;