Skip to content

Instantly share code, notes, and snippets.

View theriverman's full-sized avatar

Kristof Daja theriverman

View GitHub Profile
@theriverman
theriverman / torrent.conf
Created June 17, 2017 12:49
Transmission WebUI behind nginx proxy
server {
listen 80;
server_name torrent.domain.com;
location / { proxy_pass http://localhost:9091; }
}
@theriverman
theriverman / default.conf
Created June 17, 2017 12:57
Etherpad behind nginx served at /etherpad
server {
...
...
...
# ETHERPAD|Reverse Proxy [/etherpad]
location /etherpad/ {
rewrite /pad/(.*) /$1 break;
rewrite ^/pad$ /pad/ permanent;
proxy_pass http://localhost:9001/;
@theriverman
theriverman / common.py
Last active June 30, 2017 08:47
Postgresql Auto-fallback (initial)
DATABASES = {
"follower": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "follower",
"USER": "root",
"HOST": "54.34.65.24",
"PORT": "3306",
},
"default": {
"ENGINE": "django.db.backends.postgresql",
@theriverman
theriverman / adduser_pw.sh
Created July 3, 2017 21:02
Create user with password shell-script
#!/bin/sh
# after `=` type the user account and password you wish to create respectively
user=your_selected_account_name
password=your_supersecret_password
adduser --quiet --disabled-password --shell /bin/bash --home /home/$user --gecos "User" $user
# set password
@theriverman
theriverman / python3_lync-sample1.py
Last active March 31, 2018 10:38 — forked from msmorul/lync-sample1.py
Example python3 script for authenticating to Lync and creating an application endpoint that lists all of a persons contacts. Python example for what's described here https://ucwa.lync.com/documentation/keytasks-createapplication
import requests
import json
from urllib.parse import urlparse
sip_domain = "SIP_DOMAIN.COM"
username = "USERNAME@SIP_DOMAIN.COM"
password = "YOUR_LYNC_PASSWORD"
def extract_auth_url(_string):
@theriverman
theriverman / examplePasswordPrompt.cpp
Created February 11, 2019 23:03
C++ CLI Password Prompt Example
/*
For getUserPassword.hpp, see other gist.
Build: ++ examplePasswordPrompt.cpp -o examplePasswordPrompt
*/
#include <iostream>
#include <string>
#include "getUserPassword.hpp"
@theriverman
theriverman / getUserPassword.hpp
Created February 11, 2019 23:04
C++ password prompt with stdin masking
/*
Example code: https://gist.github.com/theriverman/b41daa62f5013126b77790b8165fcf74
ORIGINAL LOCATION OF CODE SNIPPET:
https://stackoverflow.com/questions/1413445/reading-a-password-from-stdcin
Credits: https://stackoverflow.com/users/121961/vargas
*/
#ifdef WIN32
#include <windows.h>
@theriverman
theriverman / find_keys_in_dict.py
Last active February 11, 2019 23:13
Recursively find keys in Python dictionary
def find_keys(dictionary: dict, key_name: str) -> list:
keys_list = []
def dict_recurse_search(_wh):
for k, v in _wh.items():
if k == key_name:
[keys_list.append(x) for x in v]
if isinstance(v, dict):
dict_recurse_search(v)
else:
continue
@theriverman
theriverman / README.md
Last active July 7, 2019 09:46
Full Stack Development with VSCode with Remote-SSH

Full Stack Development with VSCode with Remote-SSH

Motivation

With the latest version of Visual Studio Code it's now possible to remotely connect to a Linux host over SSH and gain a full access to it. One can access all files and access the shell within the IDE just like the user were working directly on the remote HOST.

Users can conveniently forward local ports to the remote Host, that is, services running on the remote host can be accessed using the local computer.

In case the user is a full-stack developer, for example, developing with Angular 2/x and Django, the user is probably running the following commands:

  • ng serve (Listens on localhost:4200)
@theriverman
theriverman / inter_zip_copy.py
Created November 11, 2020 23:16
Copy Between ZIP Files with Python
import os
import os.path
from pathlib import Path
import zipfile
"""
ZIP_Alpha.zip and ZIP_Beta.zip contain the following files respectively.
./demo/
├── ZIP_Alpha -> ZIP_Alpha.zip