Skip to content

Instantly share code, notes, and snippets.

View niradler's full-sized avatar
🎮

Nir Adler niradler

🎮
View GitHub Profile
@niradler
niradler / win_setup_for_developers.bat
Last active January 10, 2020 13:19
A script to run after a fresh windows installation to setup an environment for developers. (run in administrator shell)
# install chocolatey (win pkg manager like apt or brew)
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# install programing languages
choco install -y python3 golang nodejs # nvm instead of nodejs is a good option
# install apps
choco install -y vscode googlechrome 7zip.install vlc notepadplusplus.install git.install winscp curl putty
# install vm
const logform = require('logform');
const tripleBeam = require('triple-beam');
const winston = require('winston');
const errorHunter = logform.format(info => {
if (info.error) return info;
const splat = info[tripleBeam.SPLAT] || [];
info.error = splat.find(obj => obj instanceof Error);
@niradler
niradler / create-new-repo.sh
Created July 21, 2019 21:46
create new github repo with bash. ./create-new-repo.sh {repo name} [path]
#!/bin/bash
# https://medium.com/better-programming/create-github-repos-remotely-25153a6e6890
# GitHub API Token
GH_API_TOKEN=''
# GitHub User Name
GH_USER=''
# Variable to store first argument to setup-repo, the repo name. Will be used as GH repo name, too.
NEW_REPO_NAME=$1
# Store current working directory.
CURRENT_DIR=$PWD
#!/bin/bash
# configure env variable STAGE, OLDPWD
# run command in each folder
set -e
for path in $(ls projects); do
if [[ -d "projects/$path" ]]
then
echo "deploying $path"
@niradler
niradler / git-submodules.md
Created June 29, 2019 10:49 — forked from u840903/git-submodules.md
Github Submodule Cheat Sheet

Add a submodule

git submodule add https://github.com/janjarfalk/canvasrunner.git components/canvasrunner/

Update all submodules

git submodule foreach git pull origin master
cd ..
git commit . -m "Updated submodules"
@niradler
niradler / aws_clear_old_lambda_versions.js
Created June 2, 2019 20:31
How to Free AWS Lambda Code Storage (CodeStorageExceeded)
const execa = require("execa");
const fs = require("fs");
const awsCliGetCmd = ({ FunctionName = "", Version = "" }) => ({
"list-functions": `aws lambda list-functions`,
"list-versions-by-function": `aws lambda list-versions-by-function --function-name ${FunctionName}`,
"delete-function": `aws lambda delete-function --function-name ${FunctionName} --qualifier ${Version}`
});
const run = async cmd => {
@niradler
niradler / npmjs_api.txt
Created June 2, 2019 20:28
how to get npm info
get detail for package: https://registry.npmjs.org/object-remap
get detail for package by veriosn: https://registry.npmjs.org/object-remap/0.0.8
https://github.com/npm/registry/blob/master/docs/download-counts.md
https://api.npmjs.org/downloads/point/2000-01-01:3000-01-01/object-remap
http://registry.npmjs.org/-/package/babel-core/dist-tags
https://api.npms.io/v2/search?q=cross+spawn
https://api.npms.io/v2/package/react
@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
}