Skip to content

Instantly share code, notes, and snippets.

View tiagocordeiro's full-sized avatar
:octocat:
Focusing

Tiago Cordeiro ⚡ tiagocordeiro

:octocat:
Focusing
View GitHub Profile
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/riverfount/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@rg3915
rg3915 / models.py
Last active April 9, 2021 20:19
django core models base snippets django models abstract model base model
import uuid
from django.contrib.auth.models import User
from django.db import models
from localflavor.br.br_states import STATE_CHOICES
class UuidModel(models.Model):
uuid = models.UUIDField(unique=True, editable=False, default=uuid.uuid4)
class Meta:
@fnky
fnky / ANSI.md
Last active May 17, 2025 18:18
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@ScriptAutomate
ScriptAutomate / S3NakedInPublic.py
Created October 24, 2018 21:39
[Python 3 / boto3 / AWS] List all S3 buckets, in the default region config, that have 'Public' permissions listed anywhere in the ACL
import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
for oh_noes in s3.BucketAcl(bucket.name).grants:
if oh_noes['Grantee']['Type'] == 'Group' and oh_noes['Grantee']['URI'] == 'http://acs.amazonaws.com/groups/global/AllUsers':
print(bucket)
@tiagocordeiro
tiagocordeiro / pycharm-regex-django-static.md
Last active December 8, 2021 13:57
Pycharm Regex Find and Replace Static Files

Find what: (href|src)="([a-zA-Z0-9/.-]+[^.html])"

Replace with: $1=\"{% static "assets/$2" %}"

@alexellis
alexellis / sync_date_time.sh
Created February 9, 2018 10:24
Sync time and date via curl
#!/bin/bash
date -d "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')"
@JohannesDeml
JohannesDeml / README.md
Last active May 12, 2025 07:02
Batch convert images with inkscape on windows

Batch convert svg|pdf|eps|emf|wmf|ai|ps|cdr to eps|pdf|png|jpg|tiff|svg|ps|emf|wmf

Screenshot Batch converter for Windows using Inkscape with the command line
InkscapeBatchConvert is an easy to use solution to quickly convert all files of a folder to another type without the need to open Inkscape. The program uses Windows Batch scripting and will only work on Windows.
Tested with Inkscape 1.0.x - 1.3.x ✅ (The last version that supports Inkscape 0.9.x can be found here)

Usage

  1. Download _InkscapeBatchConvert.bat
  2. Put it in the folder where you have files you wish to convert (will also scan on all subfolders for files of input type).
  3. Then double click the file to start it.
@fmasanori
fmasanori / super salários USP.py
Created July 4, 2017 23:27
Super Salários USP
"""
Autores:
Tiago Henrique da Cruz Pereira
João Felipe de Moraes Borges
"""
import threading
import time
import os
from urllib.request import urlopen
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 4, 2025 21:20
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@claudiosanches
claudiosanches / functions.php
Created June 8, 2014 22:23
WooCommerce - Change product loop add to cart button
<?php
function custom_woocommerce_loop_add_to_cart_link( $html, $product ) {
return '<a href="' . get_permalink( $product->id ) . '" class="button">' . __( 'Texto do botão' ) . '</a>';
}
add_filter( 'woocommerce_loop_add_to_cart_link', 'custom_woocommerce_loop_add_to_cart_link', 10, 2 );