Skip to content

Instantly share code, notes, and snippets.

View ntedgi's full-sized avatar
:bowtie:
sudo init 6

Naor Tedgi (Abu Emma) ntedgi

:bowtie:
sudo init 6
View GitHub Profile
############################################################################################################
################## #############################
################## #############################
This Gist collection contains all localstack related examples
################## #############################
################## #############################
############################################################################################################
@ntedgi
ntedgi / checkDockerDisks.sh
Created March 2, 2022 17:01 — forked from robsonke/checkDockerDisks.sh
This Bash script will loop through all running docker containers on a host and list the disk usage per mount. In case it's breaching the 65%, it will email you.
#!/bin/bash
# get all running docker container names
containers=$(sudo docker ps | awk '{if(NR>1) print $NF}')
host=$(hostname)
# loop through all containers
for container in $containers
do
echo "Container: $container"
@ntedgi
ntedgi / download-csv
Created February 14, 2022 13:16 — forked from kiddpt/download-csv
Fast and easy CSV download by streaming for node-express
var csv = require('fast-csv');
var mysql = require('mysql');
var connection = mysql.createConnection(config.mysql);
var pool = mysql.createPool({
connectionLimit: 10,
host: config.mysql.host,
user: config.mysql.user,
password: config.mysql.password,
#
# on mac, replace TABGOESHERE with a tab by typing Ctrl-V then the Tab key
#
mysql -u USERNAME --database=dbname --host=HOST --batch -e "select * from tablename" |
sed 's/TABGOESHERE/","/g'| sed 's/^/"/g' | sed 's/$/"/g' | sed 's/\n//g' > destination.csv
@ntedgi
ntedgi / migrate_repo.sh
Created September 23, 2019 09:24 — forked from mariozig/migrate_repo.sh
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@ntedgi
ntedgi / id_rsa_encryption.md
Created March 9, 2019 11:25
Encrypt/Decrypt a File using your SSH Public/Private Key on Mac OS X

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

@ntedgi
ntedgi / anaconda-tensorflow-keras.txt
Created July 4, 2018 11:01 — forked from jeffgreenca/anaconda-tensorflow-keras.txt
Anaconda Keras / TensorFlow environment setup
Install TensorFlow (CPU), Keras, and some other tools to a new anaconda environment.
Open Anaconda Prompt
conda create --name tensorflow35 python=3.5
conda activate tensorflow35
conda install jupyter
conda install scipy
conda install spyder
pip install tensorflow
@ntedgi
ntedgi / postgres_queries_and_commands.sql
Last active July 2, 2018 11:53 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'