Skip to content

Instantly share code, notes, and snippets.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 6, 2024 21:40
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@kachar
kachar / Link-Next13.tsx
Last active May 6, 2024 21:38
Next.js Link + Material UI Link/Button components bundled with forwardRef
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active May 6, 2024 21:38
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:foo@example.com", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
@LogosITO
LogosITO / Vec2.hpp
Created May 6, 2024 21:34
C++ Vector2 Implementation.
#pragma once
#include <iostream>
#include <cmath>
#define W_EPS 0.000001
bool isEqual(double x, double y) {
return std::fabs(x - y) < W_EPS;
}
@DmitriiNazimov
DmitriiNazimov / commitConvention.md
Last active May 6, 2024 21:34 — forked from bibendi/gist:7941823
Оформление коммитов #git

Как писать коммиты

Источники

В качестве основы используется Angular Git commit Message Convention - это наиболее авторитетный источник. Все остальные вариации конвенций по коммитам ссылаются на эту.

Также достаточно авторитетным источником является conventionalcommits.org

Ниже находится краткая выжимка того, как я понял эти конвенции.

Шаблон коммита

@bibendi
bibendi / gist:7941823
Created December 13, 2013 09:21
Оформление коммитов

Для оформления сообщения коммита следует использовать следующий шаблон:

<type>(<scope>): <subject>
<BLANK LINE>
<body>

Заголовок

Тип коммита

@LarryIsBetter
LarryIsBetter / Linux Laptop Optimizations.md
Last active May 6, 2024 21:34
Linux Laptop Optimizations

I have a website now that includes a more dumbed down but straight forward version of this guide that isnt basied towards Arch Linux but considers most distros. https://linuxguidance.net/improve-battery-and-optimize-your-linux-laptop/

Everything I do in this guide is mostly taken from the Arch Wiki, and is for Arch Linux, obviously this can probably be applied to other Linux distributions especially Arch based ones, this guide is for people who want a laptop with similar effciency they had on Windows or MacOS. I hate the excuse of having to compromise on Linux to have good battery or thermals on laptops.

Please think of this guide as more of a starting point, if you're serious about fully optimizing your laptop research your laptop and the hardware inside of it as that can get you even further down the rabbit hole.

This guide assumes you have a relatively modern laptop with at least an SSD from the factory, if you don't, don't worry you can still probably follow this guide perfectly, if you have a 32-b

@martinsbruveris
martinsbruveris / tensorflow_model_surgery.ipynb
Created November 15, 2020 22:03
How to split tensorflow models into two at a given layer.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@remorses
remorses / renamer.ts
Last active May 6, 2024 21:32
Babel `BatchRenamer`, 100x faster babel `scope.rename()` when you have many identifier to rename
// original https://github.com/babel/babel/blob/9c77558234c87b9220604fbc1519089e2d6334e2/packages/babel-traverse/src/scope/lib/renamer.ts#L61
import splitExportDeclaration from '@babel/helper-split-export-declaration'
import type { Scope } from '@babel/traverse'
import { visitors } from '@babel/traverse'
import { traverseNode } from '@babel/traverse/lib/traverse-node'
import * as t from '@babel/types'
import { NodePath, Visitor } from '@babel/core'
import type { Identifier } from '@babel/types'
@biggers
biggers / exifImageMover.py
Last active May 6, 2024 21:32
rename JPEG image files by (date, time) from EXIF data -- "fork" / update of n3wtron/exifImageMover.py
#!/usr/bin/env python
from PIL import Image
import sys
import time
import os
from os import path
import shutil
from optparse import OptionParser