Skip to content

Instantly share code, notes, and snippets.

View andreagrandi's full-sized avatar
🏠
Working from home... permanently!

Andrea Grandi andreagrandi

🏠
Working from home... permanently!
View GitHub Profile
@andreagrandi
andreagrandi / indie_blogs.md
Last active August 8, 2024 13:03
My curated list of indie blogs

My curated list of indie blogs I follow.

This is a curated list of indie blogs I follow. The majority of them are tech related, but not all of them are 100% technical. I've built this list from scratch, often discovering these blogs from links/articles posted on Mastodon.

If you want to suggest me a new blog to follow, you can leave a comment below (spammers will be blocked and reported).

IF I decide to follow the suggested blog, I will take care of adding it to this list.

@andreagrandi
andreagrandi / curated_list.md
Last active July 10, 2024 11:30
This is a test
@andreagrandi
andreagrandi / main.cf
Created August 31, 2014 15:15
Postfix configuration example for email forwarding
myhostname = andreagrandi.it
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
#!/bin/bash
# This script is necessary to remove the annotations block from each Markdown file.
# These annotations are being written by iA Writer and are not necessary for the website.
# Define the directory to start searching from. Adjust this to your specific folder.
START_DIR="content"
# Process each Markdown file in the specified directory and its subfolders.
find "$START_DIR" -type f -name "*.md" | while read -r file; do
echo "Processing: $file"
@andreagrandi
andreagrandi / pelican2hugo.py
Last active February 11, 2024 09:28
Python script to migrate posts from Pelican to Hugo
# Migration script from Pelican to Hugo
import os, re, shutil
from pathlib import Path
INPUT_FOLDER = "content"
OUTPUT_FOLDER = "content-hugo"
# Custom sort key function
def sort_key(path):
# Extract the base filename without the extension
@andreagrandi
andreagrandi / settings.py
Last active November 25, 2023 14:36
Sending emails from Django during development without using a real SMTP server. Python comes with a very basic and integrated SMTP server. To start it just open a terminal and type: python -m smtpd -n -c DebuggingServer localhost:1025 Then configure your settings.py using the following parameters. You will see the email directly in the terminal …
if DEBUG:
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
DEFAULT_FROM_EMAIL = 'testing@example.com'
@andreagrandi
andreagrandi / permissions.py
Created September 30, 2016 09:49
IsAdminOrReadOnly is a custom Django Rest Framework permission class that allows Admin users to POST and anonymous to GET
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsAdminOrReadOnly(BasePermission):
def has_permission(self, request, view):
if request.method in SAFE_METHODS:
return True
else:
return request.user.is_staff
@andreagrandi
andreagrandi / parse_json_post.go
Created August 19, 2014 13:28
Parse a JSON http POST in GoLang
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type test_struct struct {
Test string
@andreagrandi
andreagrandi / .zshrc
Last active December 10, 2021 10:02
Configuration for .bashrc/.zshrc for pyenv and pyenv-virtualenv
# Install dependencies first:
# brew install pyenv
# brew install pyenv-virtualenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
@andreagrandi
andreagrandi / user_manual.md
Last active September 8, 2020 11:58
Andrea Grandi's User Manual: learn how to work with me!

Andrea Grandi User Manual

This is my user manual. If we are working together (or planning to), please read it carefully. You will learn how to deal with me productively and avoid misunderstandings.

My style

  • I need to understand why I'm doing something
  • I love working as a part of a team, not as an individual
  • I love pair programming
  • I like to have a very basic working version first and iterate on it