Skip to content

Instantly share code, notes, and snippets.

@phortuin
phortuin / signing-git-commits.md
Last active May 4, 2024 18:58
Set up a GPG key for signing Git commits on MacOS (M1)

Based on this blogpost.

To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.

Setting up

Install with Homebrew:

$ brew install gpg
@toyseed
toyseed / composition.js
Created August 20, 2019 14:32
[javascript composition] #javascript
const compose = (...fs) => (...args) => fs.reduce((arg, f) => f.apply(null, [].concat(arg)), args);
const addOne = x => x + 1;
const divide = (x, y) => x / y;
console.log(compose(divide, addOne, addOne)(8, 2));
@vinicius-stutz
vinicius-stutz / readme.md
Created April 28, 2018 23:21
Padrões de Nomenclatura em C# (pt-br)

Namespace

Por padrão toda biblioteca deve conter um nome padrão em seu namespace. Ex.: MinhaEmpresa.SeuNameSpace (padrão PascalCase).

Classes

As classes devem começar com letra maiúscula e para cada palavra, a primeira letra também deve ser maiúscula (padrão PascalCase).

C#

@wojteklu
wojteklu / clean_code.md
Last active May 4, 2024 18:57
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@unixfox
unixfox / readme.md
Last active May 4, 2024 18:57
How to get IPv4 connectivity on an IPv6 only VPS

Some hosting providers like scaleway allows to remove the IPv4 from the VPS in order to save 1€/month but doing this will result in losing connectivity to the "IPv4 world".
Or you may have ordered a VPS that only has IPv6 connectivity and you want to access to a resource only accessible from the "IPv4 world".
Here is how to gain your access back to the "IPv4 world".

Change your name servers(s) to DNS64 name servers(s)

Note: You may deploy your own DNS64 & NAT64 server on a separate server by following this tutorial (untested): https://packetpushers.net/nat64-setup-using-tayga/.
Note²: You may find a explanation of what is NAT64 and DNS64 on Wikipedia.

  1. Choose a/multiple DNS64 public server(s) that has/have its own NAT64 public service from this list:
@code-boxx
code-boxx / 0-PHP-ADMIN.MD
Last active May 4, 2024 18:56
PHP MYSQL Admin Panel Template

SIMPLE PHP MYSQL ADMIN PANEL

https://code-boxx.com/simple-php-admin-panel/

IMAGES

pic

NOTES

  1. Create a database and import 1-users.sql.
  2. Open 2-lib-admin.php, change the database settings to your own.
  3. Access 3a-login.php. The default user is joy@doe.com, and the password is 123456.
@RichardBronosky
RichardBronosky / pep8_cheatsheet.py
Created December 27, 2015 06:25
PEP-8 cheatsheet
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not PEP8-cheatsheet.py
@trongthaonh
trongthaonh / rails-validates.md
Created November 7, 2016 03:44 — forked from nashirox/rails-validates.rb
Rails のバリデーション用正規表現集

数字

# 全て数値(全角)
/^[0-9]+$/

# 全て数値(半角)
/^[0-9]+$/

# 全て数値(全角,半角)
@s8sg
s8sg / NetworkingFirecracker.md
Last active May 4, 2024 18:51
Networking with Firecracker

Create Bridge interface on the host and give internet access

sudo ip link add name br0 type bridge
sudo ip addr add 172.20.0.1/24 dev br0
sudo ip link set dev br0 up
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables --table nat --append POSTROUTING --out-interface enp3s0 -j MASQUERADE
sudo iptables --insert FORWARD --in-interface br0 -j ACCEPT

Create a tap device and link to the bridge

@JadenGeller
JadenGeller / DragModifier.swift
Last active May 4, 2024 18:50
NSFilePromiseProvider with SwiftUI, to drag a file that's loaded asynchronously
import SwiftUI
import UniformTypeIdentifiers
struct FileDragProvider: NSViewRepresentable {
var filePromise: FilePromise
var preview: PlatformImage
class NSViewType: NSView, NSFilePromiseProviderDelegate, NSDraggingSource {
var filePromise: FilePromise
var preview: PlatformImage