Skip to content

Instantly share code, notes, and snippets.

@luismts
luismts / GitCommitBestPractices.md
Last active Sep 24, 2022
Git Tips and Git Commit Best Practices
View GitCommitBestPractices.md

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@maprangzth
maprangzth / sysctl.conf
Created Oct 12, 2018 — forked from yegorg/sysctl.conf
ubuntu sysctl performance tuning
View sysctl.conf
# Kernel sysctl configuration file for Linux
#
# Version 1.12 - 2015-09-30
# Michiel Klaver - IT Professional
# http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
@micycle1
micycle1 / a.md
Created Aug 11, 2019
Downloading full-size media from DeviantArt
View a.md
  1. for direct image URL, the image quality is much lower than the original upload (the resolution and size of the original upload can be found in the right sidebar). This is not the case few years ago when the original image was accessible through right click, but on 2017, Wix acquired DeviantArt, and has been migrating the images to their own image hosting system from the original DeviantArt system. They linked most of the direct images to a stripped-down version of the original images; hence the bad image quality. Below are the three different formats of direct image URLs I found:
  • URL with /v1/fill inside: this means that the image went through Wix's encoding system and is modified to a specific size and quality. In this case, you remove ?token= and its values, add /intermediary in front of /f/ in the URL, and change the image settings right after /v1/fill/ to w_5100,h_5100,bl,q_100. The definitions of the values can be found in [Wix's Image Service](https://supp
@tctc91
tctc91 / server.js
Created Aug 11, 2018
NextJS sitemap.xml & robots.txt
View server.js
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')
const express = require('express')
const app = next({dev: process.env.NODE_ENV !== 'production'})
const handler = app.getRequestHandler()
app.prepare().then(() => {
const server = express();
@dantaex
dantaex / save-and-restore-contenteditable-selection.js
Last active Sep 24, 2022
Save and Restore DOM text selection
View save-and-restore-contenteditable-selection.js
function saveSelection() {
if (window.getSelection) {
var sel = window.getSelection();
if (sel.getRangeAt && sel.rangeCount) {
return sel.getRangeAt(0);
}
} else if (document.selection && document.selection.createRange) {
return document.selection.createRange();
}
return null;
@pdarragh
pdarragh / papers.md
Last active Sep 24, 2022
Approachable PL Papers for Undergrads
View papers.md

Approachable PL Papers for Undergrads

On September 28, 2021, I asked on Twitter:

PL Twitter:

you get to recommend one published PL paper for an undergrad to read with oversight by someone experienced. the paper should be interesting, approachable, and (mostly) self-contained.

what paper do you recommend?

@pichuang
pichuang / sources.list
Last active Sep 24, 2022
Kali Linux source.list /etc/apt/sources.list
View sources.list
deb http://kali.cs.nctu.edu.tw/kali kali-rolling main non-free contrib
#deb http://http.kali.org/kali kali-rolling main contrib non-free
#deb-src http://http.kali.org/kali kali-rolling main contrib non-free
@EgorBron
EgorBron / blockchain.py
Created Sep 24, 2022
"Blockchain" on Python. Created using lessons by Oleg Molchanov (but code here is slightly improved and minified).
View blockchain.py
import json as j, hashlib, os
def chinteg():
res = []
for f in [str(i) for i in sorted([int(ii) for ii in os.listdir('./blocks/')])][1:]:
h = j.load(fi:=open('./blocks/'+f, 'r'))['hash']; fi.close()
with open('./blocks/'+str(int(f)-1), 'rb') as fp: h2 = hashlib.md5(fp.read()).hexdigest()
res.append((int(f)-1, h2 == h))
return res
@lukaszgrolik
lukaszgrolik / font-weights.md
Last active Sep 24, 2022
Commonly used names for CSS font-weight values
View font-weights.md

unknown source

value name
100 extralight/ultralight
200 light/thin
300 book/demi/light
400 regular/normal
500 medium
600 semibold/demibold
@ryankurte
ryankurte / whatever.service
Created Jun 16, 2019
Minimal systemd unit
View whatever.service
# place in /etc/systemd/system/whatever.service and install with `systemd install whatever.service`
# note that if you change this file you will need to run `systemctl daemon-reload` to get systemd to notice
[Unit]
Description=A good service description
# After networking because we need that
After=network.target
[Service]