Skip to content

Instantly share code, notes, and snippets.

View mjtiempo's full-sized avatar

Mark John Tiempo mjtiempo

View GitHub Profile
@mjtiempo
mjtiempo / ssh-forwarding-a-b.md
Last active May 31, 2023 13:47
SSH from A through B to C, using private key on A
@mjtiempo
mjtiempo / fast_api_crud_orm.py
Created December 8, 2022 15:55
FastAPI with CRUD using ORM SQLAchemy
'''
Generated by ChatGPT using the prompt
fastapi crud using orm sqlalchemy
'''
from fastapi import FastAPI
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import sessionmaker
app = FastAPI()
engine = create_engine("<database_url>")
@mjtiempo
mjtiempo / fastapi_mongodb_with_logging.py
Created December 8, 2022 01:53
fastapi and mongodb crud with file logging
'''
Generated by ChatGPT using the prompt
fastapi crud mongo with logging to file
'''
from fastapi import FastAPI
from pymongo import MongoClient
import logging
app = FastAPI()
@mjtiempo
mjtiempo / openvpn3-cmd.sh
Created November 25, 2022 02:41
openvpn3 commands
#import config
openvpn3 config-import --config myvpnfile.ovpn
#show list of reusable configs
openvpn3 configs-list
#list active connection
openvpn3 sessions-list
#connect using config already imported
@mjtiempo
mjtiempo / x0vncserver.service
Created November 24, 2022 02:42
TigerVNC systemd service using sddm on kde plasma
[Unit]
Description=Remote desktop service (VNC) for :0 display
Requires=display-manager.service
After=network-online.target
After=display-manager.service
[Service]
Type=simple
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment XAUTHORITY=$(find /var/run/sddm/ -type f)"
Environment=HOME=/root
@mjtiempo
mjtiempo / python-dynv6-update.py
Created November 11, 2022 23:10
script to update your IPV6 address in DynV6.com
import requests
import socket
URL='http://dynv6.com/api/update'
HOSTNAME='your_dynv6_hostname'
TOKEN='your_dyn_v6_token'
'''
You can use Task scheduler to run this on windows and cron on linux
'''
@mjtiempo
mjtiempo / testrail.sh
Last active October 17, 2022 01:57
Install Testrail on Ubuntu >= 20.04
#!/usr/bin/env bash
PHP_VERSION=7.4
IONCUBE_VERSION=12.0.2
TESTRAIL_DB_NAME=testrail
TESTRAIL_DB_USER=testrail
TESTRAIL_DB_PASSWORD=testrail
DEBIAN_FRONTEND=noninteractive
echo "Updating Software"
@mjtiempo
mjtiempo / python-logging
Last active October 2, 2022 02:01
Logging to stdout and file in python
'''
src: https://stackoverflow.com/a/46098711/2433866
'''
import sys
import logging
import logging.handlers
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] %(levelname)s in %(module)s: %(message)s",
@mjtiempo
mjtiempo / asyncHttpRequests.py
Created June 16, 2021 13:39
run asyc http request using asyncio and pypeln in python
from aiohttp import ClientSession, TCPConnector
import asyncio
import sys
import pypeln as pl
import csv
limit = 1000
def csv2list(file):
results = []
with open(file, newline='') as inputfile:
@mjtiempo
mjtiempo / jitsimeet-ubuntu-20.04.sh
Created August 4, 2020 20:11
Install Jitsi meet Ubuntu 20.04
sudo su
cd &&
apt-get update -y &&
apt-get install gcc -y &&
apt-get install unzip -y &&
apt-get install lua5.2 -y &&
apt-get install liblua5.2 -y &&
apt-get install luarocks -y &&
luarocks install basexx &&