Skip to content

Instantly share code, notes, and snippets.

View xshapira's full-sized avatar

Max Shapira xshapira

View GitHub Profile
@xshapira
xshapira / gpg-safe.sh
Last active June 9, 2024 07:48 — forked from wbotelhos/gpg-safe.sh
gpg: WARNING: unsafe permissions on homedir '~/.gnupg'
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# If not, run this:
sudo chown -R $USER ~/.gnupg
# Then give the right permissions:
sudo chmod 700 ~/.gnupg
sudo chmod 600 ~/.gnupg/*

Homebrew: How to Backup & Restore Homebrew Packages

Homebrew makes it easy to install and keep installed software up to date on your Mac - as part of my backup routine for my Mac I want to be able to run a single command to reinstall all packages.

If you're searching on how to backup & restore Homebrew, then I assume you're here for the commands.

Brewfiles

Brewfiles are files generated with definitions that Homebrew reads and processes, a generated

@xshapira
xshapira / poetry-convert.py
Created May 6, 2024 06:18 — forked from tigerhawkvok/poetry-convert.py
Convert a requirements.txt file to a Poetry project
#!python3
"""
Convert a requirements.txt file to a Poetry project.
Just place in the root of your working directory and run!
"""
sourceFile = "./requirements.txt"
import re
import os
@xshapira
xshapira / CHRUBY_add_ruby_version.md
Created December 8, 2023 00:51 — forked from yannvery/CHRUBY_add_ruby_version.md
CHRUBY - How to install a new ruby version

Install a new ruby version with chruby

OSX

First of all you must update ruby-build to update definitions list.

brew update

And update ruby-build

@xshapira
xshapira / settings.py
Created February 25, 2023 08:59
Django 4.1+ -- fix HTML templates not being updated in development.
# Starting with Django 4.1+ we need to pick which template loaders to use
# based on our environment since 4.1+ will cache templates by default.
default_loaders = [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
]
cached_loaders = [("django.template.loaders.cached.Loader", default_loaders)]
@xshapira
xshapira / workbench.colorCustomizations.json
Created February 4, 2023 11:39 — forked from trungpq163/workbench.colorCustomizations.json
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",
@xshapira
xshapira / async_kafka_prod_cons.py
Created January 21, 2023 10:20 — forked from vcabral19/async_kafka_prod_cons.py
playing with async python and kafka
import asyncio
from confluent_kafka import Consumer, Producer
from confluent_kafka.admin import AdminClient, NewTopic
BROKER_URL = "PLAINTEXT://localhost:9092"
TOPIC_NAME = "my-first-python-topic"
@xshapira
xshapira / kafka_connect.py
Created January 21, 2023 10:19 — forked from iKunalChhabra/kafka_connect.py
Kafka consumer producer class in python
from confluent_kafka import Consumer, Producer, KafkaError, KafkaException
class Kafka:
def __init__(self, bootstrap_server, topic, timeout=1.0):
self.__bootstrap_server = bootstrap_server
self.__topic = topic
self.__timeout = timeout
@staticmethod
@xshapira
xshapira / python_datetime_snippets.md
Created January 21, 2023 08:00 — forked from genadyp/python_datetime_snippets.md
How to convert in python local time string to UTC?
@xshapira
xshapira / main.py
Last active April 30, 2024 06:48
Selenium-lotto-results
"""
This script will:
- open a Firefox browser
- navigate to the form page
- fill out the form and submit it
- navigate to the results page
- scrape the data from the page and close the browser
"""
import json