Skip to content

Instantly share code, notes, and snippets.

View ovntatar's full-sized avatar

Ovidiu N. Tatar ovntatar

View GitHub Profile
@ovntatar
ovntatar / .bashrc
Last active June 24, 2022 09:01
.bashrc
# Skip this config if we aren't in bash
[[ -n "${BASH_VERSION}" ]] || return
# ~/.bashrc: executed by bash(1) for non-login shells.
# .see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If running non interactively, do nothing
########################################################
#|# Preamble #
@ovntatar
ovntatar / test-port-connection.py
Last active April 8, 2022 12:02
Python one line access remote port
python -c "import socket; socket.setdefaulttimeout(2); print('Port is up √') if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('google.com',4413)) else print('Port is down †')"
@ovntatar
ovntatar / git-cli-overview.txt
Last active March 13, 2023 08:21
git overview
### How to write a Git commit message
https://chris.beams.io/posts/git-commit/
1. Separate subject from body with a blank line
2. Limit the subject line to 50 characters
3. Capitalize the subject line
4. Do not end the subject line with a period
5. Use the imperative mood in the subject line
@ovntatar
ovntatar / vimrc
Created November 25, 2019 15:59
vimrc Syntax Highlighting for Cisco
syntax enable
set background=dark
set nocompatible
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set ruler
set virtualedit=all
@ovntatar
ovntatar / install-mongo.sh
Last active January 22, 2018 13:21
install mongo 3.6
#!/bin/bash
echo "precedence ::ffff:0:0/96 100" >> /etc/gai.conf
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
apt-get update -y
sudo apt-get install -y mongodb-org
git reset --hard <old-commit-id>
git push -f
kill $(ps aux | grep 'firefox' | awk '{print $2}')
@ovntatar
ovntatar / virtualenvwrapper
Created September 9, 2016 20:04
python virtualenvwrapper
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv --python=/usr/bin/python3.5 <Project>
workon memorial
sudo apt-get install libevent-dev python-dev python3-dev
export export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh
PYTHONPATH="/home/research/Env/<Project>"
@ovntatar
ovntatar / readMongoDBSize.js
Created August 11, 2016 07:25
read human readable size from MongoDB collections
# inspired by https://gist.github.com/joeyAghion/6511184
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
#!/usr/bin/env perl
use strict;
use warnings;
BEGIN { $SIG{INT} = $SIG{TERM} = sub { exit 0 } }
use Getopt::Long;
use Pod::Usage;
GetOptions (