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 / 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
#!/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 / 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 / osx-cmake-fix.sh
Created July 12, 2021 19:26
OSX fixing missing cmake executable
# Install cmake with homebrew, which prevents:
# AssertionError: Could not find "cmake" executable!
brew install cmake
# and then install protobuf which fixes:
# CMake Error at CMakeLists.txt:292 (message):
# Protobuf compiler not found
# Call Stack (most recent call first):
# CMakeLists.txt:323 (relative_protobuf_generate_cpp)
brew install protobuf
@alfredodeza
alfredodeza / Vagrantfile
Created February 26, 2020 16:45
Handy vagrantfile for local VMs with some custom IP/CPU/ram mappings
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.define 'node1' do |node1|
node1.vm.box = "ceph/ubuntu-bionic"
node1.vm.network :private_network, :ip => "192.168.111.100"
$ minishift start --show-libmachine-logs -v5
-- minishift version: v1.30.0+186b034
-- Starting profile 'minishift'
Found binary path at /usr/local/bin/docker-machine-driver-xhyve
Launching plugin server for driver xhyve
Plugin server listening at address 127.0.0.1:55267
() DBG | operation not supported by device
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
@alfredodeza
alfredodeza / iterm-to-hex.py
Created April 23, 2018 12:55
read an itermcolors export file and spit out Vim 8's ansi color var
#!/usr/bin/env python
#
# Convert .itermcolors files to hex colors
import sys
import xml.etree.ElementTree as ET
def rgb_to_hex(rgb):
return '#%02x%02x%02x' % rgb