Skip to content

Instantly share code, notes, and snippets.

View KavenTheriault's full-sized avatar

Kaven Thériault KavenTheriault

View GitHub Profile

mongodump command example

mongodump --host localhost:27017 --username=user --password=password --db=db_name --authenticationDatabase=admin
@KavenTheriault
KavenTheriault / create_gitlab_deploy_key.md
Created March 20, 2019 19:03
Create GitLab project deploy key

Create GitLab project deploy key

Generate key

cd ~/.ssh/
ssh-keygen -t ed25519 -C "project_name_deployment"
  • Input a file path to save your SSH key pair to. Example project_name_deployment_rsa
  • Enter a passphrase if you want. You can skip creating it by pressing Enter twice.
  • Backup the key somewhere safe and secure
@KavenTheriault
KavenTheriault / serveo.md
Created December 20, 2018 14:01
Expose local servers to the internet

Expose localhost port 8000 to the internet

ssh -R 80:localhost:8000 serveo.net

https://serveo.net/

@KavenTheriault
KavenTheriault / angular_notes.md
Last active November 24, 2018 16:54
Angular `Observables` notes

Angular Observables notes

https://angular.io/guide/rx-library

  • A promise can be subcribed.
  • It will give an observable.
const secondsCounter = interval(1000);
secondsCounter.subscribe(n =>
  console.log(`It's been ${n} seconds since subscribing!`));
@KavenTheriault
KavenTheriault / python_notes.md
Last active November 29, 2018 16:15
Python notes

Named tuples

from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])

point1 = Point(24, 67)
print(point1.x)
print(point1.y)

All you need is your rsa key file

cp name_rsa ~/.ssh/
chmod 400 ~/.ssh/name_rsa

cat >> ~/.ssh/config <<EOF
Host dev.website.com my_connection_name
Hostname {server_ip_address}
User {username}
@KavenTheriault
KavenTheriault / export_env_file.md
Last active October 19, 2018 17:35
Export env file with one line command
export $(grep -v '^#' .env | xargs)
@KavenTheriault
KavenTheriault / screen_cheat_sheet.md
Created October 1, 2018 15:03
Screen Cheat Sheet

start a new screen session with session name

$ screen -S <name>

list running sessions/screens

$ screen -ls

attach to a running session

@KavenTheriault
KavenTheriault / firewalld_daemon.md
Created October 1, 2018 12:51
Open port with firewall-cmd

Show all opened ports

$ sudo firewall-cmd --list-all

To open up a new port (e.g., TCP/80) permanently, use these commands. Without --permanent flag, the firewall rule would not persist across reboots.

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
@KavenTheriault
KavenTheriault / delete_redis_keys.md
Created June 11, 2018 15:35
Delete redis keys without ttl

The following operations need to be run on a unix system. You can use Bash on Windows is you have a Windows OS.

Install redis client

$ sudo apt-get install redis-tools

Create script file

Create the following bash file