Skip to content

Instantly share code, notes, and snippets.

View grandsilence's full-sized avatar
💻
Freelancer

Grand Silence grandsilence

💻
Freelancer
View GitHub Profile
@vbsessa
vbsessa / chrome-devtools.md
Last active February 28, 2025 03:42
How to customize Chrome devtools fonts
  1. Enable #enable-devtools-experiments flag in chrome://flags section.

  2. Open Chorme Devtools and check Settings > Experiments > Allow extensions to load custom stylesheets.

  3. Create the following four files in a dedicated folder.

    3.1. devtools.html

    <html>
    <head></head>
    <body><script src="devtools.js"></script></body>
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active April 2, 2025 11:18
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@jim3ma
jim3ma / http_proxy.go
Created January 25, 2017 02:11
Register Dialer Type for HTTP&HTTPS Proxy in golang
package main
import (
"bufio"
"fmt"
"net"
"net/http"
"net/url"
"crypto/tls"
@xjdrew
xjdrew / client.go
Last active February 9, 2025 16:52
golang tls client and server, require and verify certificate in double direction
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@zmts
zmts / tokens.md
Last active April 6, 2025 04:57
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@nodkz
nodkz / package.json
Created November 20, 2017 10:15
Ram disk via scripts
{
"scripts": {
"ram": "yarn ram-check-disk && yarn ram-create-disk && yarn ram-link-node-modules && yarn ram-link-build && yarn install && yarn start",
"ram-check-disk": "[ -d /Volumes/npm_ram_disk ] && echo 'Disk already mounted!' && yarn build && exit 1 || exit 0",
"ram-create-disk": "diskutil erasevolume hfsx npm_ram_disk `hdiutil attach -nomount ram://1600000`",
"ram-link-node-modules": "mkdir /Volumes/npm_ram_disk/node_modules && rm -r -f ./node_modules && ln -s /Volumes/npm_ram_disk/node_modules ./node_modules",
"ram-link-build": "mkdir /Volumes/npm_ram_disk/build && rm -r -f ./build && ln -s /Volumes/npm_ram_disk/build ./build",
}
}
@mhingston
mhingston / PBKDF2.cs
Last active November 25, 2022 07:16
PBKDF2 for node and C#
using System;
using System.Security.Cryptography;
public class PBKDF2
{
private int hashBytes;
private int saltBytes;
private int iterations;
public PBKDF2(int _hashBytes, int _saltBytes, int _iterations)
/**
* TypeScript version of @istarkov's cancellable Promise wrapper.
*
* @see https://github.com/facebook/react/issues/5465#issuecomment-157888325
*/
const makeCancelable = <T>(promise: Promise<T>): { promise: Promise<T>; cancel(): void } => {
let hasCanceled = false;
const wrappedPromise = new Promise<T>((resolve, reject) => {
promise.then(
@erikvullings
erikvullings / deep-copy.ts
Last active September 3, 2024 09:02
Deep copy or clone in TypeScript
/**
* Deep copy function for TypeScript.
* @param T Generic type of target/copied value.
* @param target Target value to be copied.
* @see Source project, ts-deepcopy https://github.com/ykdr2017/ts-deepcopy
* @see Code pen https://codepen.io/erikvullings/pen/ejyBYg
*/
export const deepCopy = <T>(target: T): T => {
if (target === null) {
return target;
@qdm12
qdm12 / readme.md
Last active April 8, 2024 08:45
Wireguard setup for Ubuntu server with LAN access

Wireguard setup for LAN access

Assumptions

  • The network 192.168.1.0/24 is your LAN
  • Your Ubuntu server is on your LAN at 192.168.1.10, through the network interface eth0
  • The network 192.168.5.0/24 is non existent
  • Your LAN DNS is at 192.168.1.1