Skip to content

Instantly share code, notes, and snippets.

View v1shwa's full-sized avatar
:octocat:
⚡️

Vishwa v1shwa

:octocat:
⚡️
View GitHub Profile
@v1shwa
v1shwa / vigenere.py
Created April 3, 2019 12:52
Vigenere Cipher
import base64
def encode(key, clear):
enc = []
for i in range(len(clear)):
key_c = key[i % len(key)]
enc_c = chr((ord(clear[i]) + ord(key_c)) % 256)
enc.append(enc_c)
return base64.urlsafe_b64encode("".join(enc).encode()).decode()
def decode(key, enc):
@v1shwa
v1shwa / dynamic_subdomains
Created March 21, 2019 13:54
Dynamically map subdomains to different ports on the server - using Nginx
server {
listen 80;
# maps p8080.example.com -> localhost:8080
server_name ~^p(?<port>[^.]+)\.example\.com$;
location / {
proxy_pass http://localhost:$port;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@v1shwa
v1shwa / README.md
Created February 26, 2018 02:38 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


@v1shwa
v1shwa / sublime_remote_setup.md
Last active July 10, 2017 14:36
Editing Remote files with Sublime Text Raw

Client Setup

  • Add Remote Forwading by default for all hosts. Open ~/.ssh/config file and add these lines

    Host *
      RemoteForward 52698 127.0.0.1:52698
    
  • Open Sublime Text, Install rsub package using package control.

@v1shwa
v1shwa / git-multiple-users-fix.md
Created May 24, 2017 06:01
GIT - Permission denied <repo> to different_user

FIX 1: Change your ssh config

Host work.github
    HostName github.com
    User WORK_USERNAME
    IdentityFile ~/.ssh/id_work_rsa

Host home.github
    HostName github.com
    User HOME_USERNAME 

PreferredAuthentications publickey

@v1shwa
v1shwa / github-ssh-fix.md
Last active January 19, 2017 12:17
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

ssh-add github_private_key

@v1shwa
v1shwa / matplotlib-issue.md
Created January 5, 2017 06:17
Matplotlib font cache issue
  • Remove the lib cache rm -rf ~/.cache/matplotlib
  • Done!
@v1shwa
v1shwa / swap.sh
Created December 19, 2016 08:09
Quick temporary swap
#!/bin/bash
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Verification
sudo swapon -s
# Copyright (c) 2013 Georgios Gousios
# MIT-licensed
# Edited to handle two new tables: postLinks and tags that are present in the 2014 dataset
create database stackoverflow DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
use stackoverflow;
create table badges (
Id INT NOT NULL PRIMARY KEY,