npm init
: NPM package manifest wizardnpm whoami
: check for the authenticated usernpm adduser
: add a user to the NPM sessionnpm init --scope=<username>
: add the auth user to the NPM .json manifestnpm install <modulename>
: installing a specific NPM module or packagenpm ls
: dependencies listing (specific directory)npm test
: run tests using the scripts located at the package.json file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib2 | |
class DisallowPresent(Exception): | |
def __init__(self, path) : | |
self.disallowed = path | |
def __str__(self) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# socket network module (methods and APIs) | |
import socket | |
import sys | |
# creating a TCP Socket -> listening to an specific port | |
# AF_INET -> address family , SOCK_STREAM -> Kind of socket (required) | |
tcpSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt-get update | |
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs yarn | |
cd | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
exec $SHELL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update && apt-get install nginx -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[server] | |
Here goes your Droplet IP | |
[server:vars] | |
ansible_user=root | |
ansible_ssh_private_key_file=~/.ssh/id_rsa.pub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# deleting - disabling linux accounts | |
readonly ARCHIVE_DIR='/archive' # program variable | |
usage() { | |
echo "Usage: ${0} [-dra] USER [USERN]" | |
echo "Disable a local Linux account" | |
echo "-d Deletes accounts instead of disabling them" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script shows the open network ports on a system | |
# -4 to limit TCP IPv4 ports | |
if [[ "${1}" = '-4' ]] | |
then | |
netstat -nutl ${1} | grep ':' | awk '{print $4}' | awk -F ':' '{print $NF}' | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure("2") do |config| | |
config.vm.box = "jasonc/centos7" | |
# first machine | |
config.vm.define "admin01" do |admin01| | |
admin01.vm.hostname = 'admin01' | |
admin01.vm.network "private_network", ip: "10.9.8.10" | |
end | |
# second machine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import shutil | |
import _winreg as wreg | |
import subprocess | |
# getting the cwd | |
path = os.getcwd().strip('\n') | |
# grabbing the username using a subprocess command for building the destination path | |
null, user = subprocess.check_output('set USERPROFILE', shell=True).split('=') # C:\Users\Administrador |
OlderNewer