Skip to content

Instantly share code, notes, and snippets.

View alfredodeza's full-sized avatar
:octocat:

Alfredo Deza alfredodeza

:octocat:
View GitHub Profile
@alfredodeza
alfredodeza / how-to.txt
Last active February 2, 2024 18:47
pdf output from sphinx with rst2pdf
1. Install rst2pdf
- use your package manager (or)
- pip install rst2pdf (or)
- easy_install rst2pdf
2. Add rst2pdf to the list of extensions in conf.py
extensions = ['rst2pdf.pdfbuilder']
@alfredodeza
alfredodeza / remote-desktop.md
Last active December 14, 2023 16:27
Remote k8s with docker-desktop using an SSH tunnel

Remote Kubernetes using SSH

My setup is using a Macmini with Docker for Desktop installed and with the Kubernetes option enabled. The main objective of the setup: use kubectl directly without any additional flags from my local computer, accessing/interacting the remote k8s instance

Ensure SSH is setup with key-based authentication

Copy public key to the remote authorized_keys file

cat ~/.ssh/id_rsa.pub | ssh admin@macmini-server 'umask 0077; mkdir -p .ssh; cat >> .ssh/authorized_keys'
@alfredodeza
alfredodeza / README.md
Created December 12, 2023 00:12
Force Forward DNS in Edge Router

Force DNS to any client on your network

Enforce any client that uses port 53 for a DNS lookup to get redirected to the DNS server of your choice. This effectively forces any client with custom or self-configured DNS to still go through your DNS server of choice.

UI Settings

Navigate to the UI and then to: Firewall/NAT -> NAT. Click on "Add a Destination NAT Rule". In my case eth1 is the port all clients go and eth0 is where the WAN goes in, and 192.168.0.1 is the router itself where the DNS server is

  • Inbound interface: eth1
  • Translations Address: 192.168.0.1
@alfredodeza
alfredodeza / dosini.vim
Created January 12, 2017 21:22
Syntax file for tox.ini
" Vim syntax file
" Language: Configuration File (ini file) for Python's tox
" Version: 0.1
" Original Author: Alfredo Deza
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
#!/bin/bash
set -x
# Get all users
USERS=`az ad user list -o tsv --query "[].id"`
# Grant them the Azure Active Directory built-in role (not an Azure role!)
# The cf1c3... id comes from https://learn.microsoft.com/en-us/azure/active-directory/roles/permissions-reference
# Specifically, it is the Application Developer role which has the "Template ID" in that table
for USER in $USERS; do
@alfredodeza
alfredodeza / gist:f3b42d4fd1ab958da29475efbcee8cd7
Created January 2, 2023 21:21
Use avconvert to encode MOV files to MP4 using h264
destination_dir=$(dirname $1)
input_filename=$(basename $1)
name=$(basename ${input_filename} .mov)
output_path="$destination_dir/$name.mp4"
avconvert --preset Preset1920x1080 --source $1 --output $output_path
if [ $? -eq 0 ]; then
mv $1 /tmp/
fi
# This workflow will build and push a Python application to an Azure Web App when a commit is pushed to your default branch.
#
# This workflow assumes you have already created the target Azure App Service web app.
# For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=bash&pivots=python-framework-flask
#
# To configure this workflow:
#
# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal.
# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials
#
@alfredodeza
alfredodeza / markdown_links.md
Created July 18, 2022 12:42
Markdown links for GitHub repository
@alfredodeza
alfredodeza / whisper.vim
Created May 11, 2015 14:28
map the undo to whisper balls
" I don't remember exactly how to make it not spit out the actual command you are running. Meh.
nnoremap u :call system("say -v whisper 'balls'")<CR>
@alfredodeza
alfredodeza / real.py
Last active April 26, 2022 10:58
Real time subprocess stdout/stderr
import logging
import threading
import os
import subprocess
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
class LogPipe(threading.Thread):