Skip to content

Instantly share code, notes, and snippets.

username=""
publickey=""
create_user () {
sudo adduser $1
sudo echo $1 | passwd --stdin $1
echo "user" $1 "created"
sudo mkdir -p /home/$1/.ssh
echo "directory user" $1 "created"
sudo cat <<EOF >> authorized_keys
@acepsaepudin
acepsaepudin / install NVM and nodeJS.yml
Created March 8, 2019 18:43 — forked from komuw/install NVM and nodeJS.yml
Ansible task to install nvm and nodeJS
#first seen here: http://www.snip2code.com/Snippet/63701/Ansible-task-to-install-nvm-and-node
# Here is how to install nvm and node in an Ansible task.
# I tried a bunch of different things, and as usual it's simple, but you have to get it right.
# The important part is that you have to shell with /bin/bash -c and source nvm.sh
---
- name: Install nvm
shell: >
curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
creates=/home/{{ ansible_user_id }}/.nvm/nvm.sh
@acepsaepudin
acepsaepudin / web-servers.md
Last active February 20, 2019 01:05 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@acepsaepudin
acepsaepudin / postgres_journaling.sh
Created October 26, 2018 19:11 — forked from adriancb/postgres_journaling.sh
Create separate partition for Postgres
# create a separate partition and initialize with ext4
sudo mkfs.ext4 /dev/xvdb
# turn off journaling
sudo tune2fs -o journal_data_writeback /dev/xvdb
sudo tune2fs -O ^has_journal /dev/xvdb
# add to fstab
echo '/dev/xvdb /mnt/databases ext4 defaults,auto,noatime,nodiratime,noexec 0 0' | sudo tee -a /etc/fstab
@acepsaepudin
acepsaepudin / Instructions.sh
Created October 18, 2018 01:50 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@acepsaepudin
acepsaepudin / windows_console_colors_monokai.reg
Created September 14, 2018 17:10 — forked from lnishan/windows_console_colors_monokai.reg
Monokai theme for Windows console (Bash on Ubuntu on Windows, Windows Subsystem for Linux)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
; 00BBGGRR, not RGB!
"ColorTable00"=dword:00222827 ; 0 - black
"ColorTable04"=dword:004e06cc ; 1 - dark red
"ColorTable02"=dword:0018ac7a ; 2 - dark green
"ColorTable06"=dword:0045a9f0 ; 3 - dark yellow
"ColorTable01"=dword:00e9C721 ; 4 - dark blue
"ColorTable05"=dword:00ff337e ; 5 - dark magenta
@acepsaepudin
acepsaepudin / psql-with-gzip-cheatsheet.sh
Created August 23, 2018 14:08 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GistRun</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Hello world!</h1>
<script src="script.js"></script>
@acepsaepudin
acepsaepudin / gist:3d994953e998f14ec9f82778aa214eb9
Created April 1, 2018 17:53 — forked from afair/gist:3803895
PostgreSQL and Pgpool Architecture

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture