Skip to content

Instantly share code, notes, and snippets.

View eliocapelati's full-sized avatar
👋
Hello world!

Elio eliocapelati

👋
Hello world!
View GitHub Profile
@kepano
kepano / obsidian-web-clipper.js
Last active April 25, 2024 05:19
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@rponte
rponte / using-uuid-as-pk.md
Last active April 22, 2024 21:42
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

@jonnyjava
jonnyjava / working_effectively_with_legacy_code.md
Created November 4, 2019 21:51
Working effectively with legacy code summary

WORKING EFFECTIVELY WITH LEGACY CODE

To me, legacy code is simply code without tests. I’ve gotten some grief for this definition. What do tests have to do with whether code is bad? To me, the answer is straightforward, and it is a point that I elaborate throughout the book: Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.

Chapter 1 Changing Software

Four Reasons to Change Software: For simplicity’s sake, let’s look at four primary reasons to change software.

@jzbruno
jzbruno / click_conditional_options.py
Last active April 5, 2021 19:04
An example of conditionally prompting for options when a flag is set using the click library.
import click
def prompt_proxy(ctx, param, use_proxy):
if use_proxy:
host = ctx.params.get('proxy_host')
if not host:
host = click.prompt('Proxy host', default='localhost')
port = ctx.params.get('proxy_port')
@pudquick
pudquick / lockscreen.py
Created December 23, 2015 19:12
Programmatically immediately lock the screen of a Mac running OS X, regardless of security settings, screensaver settings, or Fast User Switch settings
from ctypes import CDLL
loginPF = CDLL('/System/Library/PrivateFrameworks/login.framework/Versions/Current/login')
result = loginPF.SACLockScreenImmediate()
@eliocapelati
eliocapelati / osx-for-hackers.sh
Last active August 27, 2015 13:39 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@gabbaybr
gabbaybr / createPuppetModule.sh
Last active August 29, 2015 14:12
Simple shell script to create Puppet structure folders
#!/usr/bin/env bash
NEW_MODULE=$1
NC='\e[0m' #sem cor
PK='\e[91m' #Vermelho
BK='\e[33m' #Bold
YL='\e[4m' #Amarelo
set -e
################################################################################
@subfuzion
subfuzion / global-gitignore.md
Last active April 23, 2024 22:47
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@soarez
soarez / ca.md
Last active April 22, 2024 03:01
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.