Skip to content

Instantly share code, notes, and snippets.

View KavenTheriault's full-sized avatar

Kaven Thériault KavenTheriault

View GitHub Profile
@KavenTheriault
KavenTheriault / simple_http_proxy.md
Last active May 29, 2024 16:08
Use SSH to Create an HTTP Proxy

Use SSH to Create an HTTP Proxy

All you need is virtual private server (VPS). Use the following command to open up the port 1080 on your local machine as a SOCKS proxy so all your HTTP traffic can be specified to go through the SSH tunnel and out remote_ssh_server on the other end.

$ ssh -D 1080 -f -C -q -N -p 22 user@server-ip

Use the SOCKS proxy in chrome

@KavenTheriault
KavenTheriault / setup_ssh_keys_on_server.md
Last active June 26, 2018 15:34
SSH login without password using SSH keys

SSH login without password using SSH keys

Using ssh-copy-id command

ssh-copy-id -i ~/.ssh/my_key_rsa user@server_address

Manually

Enabling AuthorizedKeys

@KavenTheriault
KavenTheriault / MoveSQLFiles.md
Created January 5, 2018 20:26
Move SQL Server database files

Move SQL Server database files

1- Set the database offline

ALTER DATABASE DatabaseName SET OFFLINE WITH ROLLBACK IMMEDIATE;

2- Now you can move the files manualy

3- Set the new files location

@KavenTheriault
KavenTheriault / Docker.md
Last active April 16, 2019 14:10
Docker cheat sheet

Build Image

Run at Dockerfile location or replace . with the the Dockerfile path

$ docker build -t image_name .

Images

$ docker images
$ docker rmi image_name
@KavenTheriault
KavenTheriault / clean_code.md
Last active August 21, 2018 07:24 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

What is Clean Code

  • elegant and efficient
  • does one thing well
  • can easily be read, and enhanced by a developer other than its original author
  • meaningful names
  • minimal dependencies
  • has unit and acceptance tests
  • clean code always looks like it was written by someone who cares
  • nothing obvious that you can do to make it better
  • no duplication
@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

@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 / 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 / export_env_file.md
Last active October 19, 2018 17:35
Export env file with one line command
export $(grep -v '^#' .env | xargs)

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}