Skip to content

Instantly share code, notes, and snippets.

View carlessanagustin's full-sized avatar

carles san agustin carlessanagustin

View GitHub Profile
@carlessanagustin
carlessanagustin / ssl_keys.bash
Last active January 11, 2022 06:32
SSL files & folders permissions
#!/usr/bin/env bash
sudo su -
mkdir /etc/ssl
mkdir /etc/ssl/certs
mkdir /etc/ssl/private
chmod 755 /etc/ssl
chmod 755 /etc/ssl/certs
@carlessanagustin
carlessanagustin / nginx-ssl.conf
Created February 19, 2016 07:49
Nginx with SSL to Jenkins
upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
# server_name jenkins.domain.tld;
return 301 https://$host$request_uri;
}
@carlessanagustin
carlessanagustin / find-file-in-files.md
Created February 25, 2016 11:07
Finding all files containing a text string on Linux

Finding all files containing a text string on Linux

Do the following:

grep -rnw '/path/to/somewhere/' -e "pattern"

-r or -R is recursive, -n is line number and -w stands match the whole word. -l (lower-case L) can be added to just give the file name of matching files.

@carlessanagustin
carlessanagustin / postgres-cheatsheet.md
Created February 29, 2016 09:44 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@carlessanagustin
carlessanagustin / ansible-path.md
Last active December 3, 2019 19:11
updating PATH with ansible - system wide

Option 1

- name: compile sources
  shell:
    coffee -o lib -c src 
    chdir=${mysourcedir}
  environment:
    PATH: $PATH:/opt/node/bin
@carlessanagustin
carlessanagustin / get-ip-address.sh
Created March 14, 2016 09:42
Get only the IP address
# method 1
$ echo $(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
# method 2
$ echo $(ip -o -4 addr list eth0 | perl -n -e 'if (m{inet\s([\d\.]+)\/\d+\s}xms) { print $1 }')
@carlessanagustin
carlessanagustin / remote-ssh.sh
Created March 21, 2016 15:21
Configuring SSH remote access
# local instance
ssh-keygen -b 2048 -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
# remote instance
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.1
# more: https://www.digitalocean.com/community/tutorials/how-to-use-ssh-to-connect-to-a-remote-server-in-ubuntu
@carlessanagustin
carlessanagustin / bash-cheatsheet.md
Last active February 28, 2018 16:59 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems

#!/usr/bin/env bash

0. Shortcuts.

CTRL+A  # move to beginning of line
CTRL+B  # moves backward one character
CTRL+C  # halts the current command
CTRL+D  # deletes one character backward or logs out of current session, similar to exit
CTRL+E  # moves to end of line
#!/usr/bin/env python
"""
Basic script to create an empty python package containing one module
"""
from skeleton import Skeleton, Var
class BasicModule(Skeleton):
"""
Create an empty module with its etup script and a README file.
@carlessanagustin
carlessanagustin / win2ix.md
Last active May 21, 2024 21:13
Windows and Unix command line equivalents
Windows command Unix command Notes
set env Set on Windows prints a list of all environment variables. For individual environment variables, set is the same as echo $ on Unix.
set Path export $PATH Print the value of the environment variable using set in Windows.
set PROJ -- result: PROJ=c:\project
echo %PROJ% echo $PROJ result: c:\project

|