Skip to content

Instantly share code, notes, and snippets.

View marceloneppel's full-sized avatar

Marcelo Henrique Neppel marceloneppel

View GitHub Profile
@deusebio
deusebio / tcpdump_parser.py
Created September 19, 2023 08:46
Parse tcpdump output
import pandas as pd
import re
space_splitter = re.compile("\s+")
regex = re.compile("\s*(.*)\s*>\s*(.*?):\s.*")
def parse_line(line):
try:
elements = space_splitter.split(line)
source_dest = regex.match(" ".join(elements[4:])).groups()
@SKaplanOfficial
SKaplanOfficial / saved_current_url.py
Last active September 15, 2023 16:22
PyXA script to save the current Safari tab's URL to a "Saved URLs" note
#!/usr/bin/env python
# Test with PyXA 0.1.0
import PyXA
safari = PyXA.Application("Safari")
notes = PyXA.Application("Notes")
# Get info for current Safari tab
current_tab = safari.front_window.current_tab
@paulomach
paulomach / cheat_sheet_charms.md
Last active December 7, 2022 18:22
Charm cheat sheet

some useful charm dev commands

Info about published charm

> juju info

# basic data
juju info <charm-name>
@SKaplanOfficial
SKaplanOfficial / select_photos_for_mosaic.py
Last active September 15, 2023 16:22
Using PyXA, Automator, and PIL to create a mosaic of selected images.
import PyXA, math
from PIL import Image
# Execute Automator workflow and receive list of image paths
automator = PyXA.Application("Automator")
workflow = automator.open("/Users/exampleuser/Library/Mobile Documents/com~apple~Automator/Documents/Ask For Photos.workflow")
image_paths = workflow.execute()
# Set base dimensions of mosaic images
base_width = 400
@SKaplanOfficial
SKaplanOfficial / count_shortcuts.py
Last active September 15, 2023 16:22
Using PyXA to get the number of shortcuts in each shortcuts folder
# Tested with PyXA 0.1.0
import PyXA
app = PyXA.Application("Shortcuts")
folders = app.folders()
# Method 1 - Standard iteration
summary = []
for folder in folders:
folder_name = folder.name
num_shortcuts = len(folder.shortcuts())
@paulomach
paulomach / Makefile.md
Last active February 21, 2023 17:13
Makefile for k8s/vm charms

There's some mysql specifics, but it's mostly generic

help: ## show help message
	@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf "  \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

SHELL    := /bin/bash
unit     := 0
app      := $(shell yq '.name' metadata.yaml)
scale    := 3
@33eyes
33eyes / commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
Last active June 29, 2024 08:08
How to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally

Commit jupyter notebooks code to git and keep output locally

  1. Add a filter to git config by running the following command in bash inside the repo:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'  
  1. Create a .gitattributes file inside the directory with the notebooks

  2. Add the following to that file:

@paulera
paulera / how-to-take-psm-I-scrum-org.md
Last active June 28, 2024 06:07
A practical guide to prepare and take the PSM I (Professional Scrum Master 1) certification, from Scrum.org, entirely by yourself (no course required).

How to take the PSM I certification from Scrum.org entirely by yourself

Some people ask me about Scrum.org certifications: what to study, how to apply for the exam and advice for taking it. So I decided to write a guide for those interested in preparing and taking PSM I (Professional Scrum Master) without spending a fortune with training. With discipline, in around a month (or two), you should be ready to take the test.

The advice compiled here came from experienced agile coaches. Worked very well for me and I hope they will also help those who are seeking directions.

Table of Contents

@suapapa
suapapa / record.go
Created April 19, 2020 08:20
raw audio recording with portaudio and golang
package main
import (
"encoding/binary"
"fmt"
"os"
"os/signal"
"time"
"github.com/gordonklaus/portaudio"
@kadereub
kadereub / numba_polyfit.py
Last active June 10, 2024 16:44
A numba implementation of numpy polfit
# Load relevant libraries
import numpy as np
import numba as nb
import matplotlib.pyplot as plt
# Goal is to implement a numba compatible polyfit (note does not include error handling)
# Define Functions Using Numba
# Idea here is to solve ax = b, using least squares, where a represents our coefficients e.g. x**2, x, constants
@nb.njit