Skip to content

Instantly share code, notes, and snippets.

View genyrosk's full-sized avatar
🚀

Evgeny Roskach genyrosk

🚀
View GitHub Profile
@jonshipman
jonshipman / docker-compose.yml
Last active November 11, 2023 13:00
Nginx Reverse Proxy with Acme Companion
version: '3.9'
services:
reverse-proxy:
container_name: 'reverse-proxy'
restart: 'always'
image: 'nginxproxy/nginx-proxy'
ports:
- 80:80
- 443:443
volumes:
@rochacbruno
rochacbruno / fastapi_session.py
Last active June 29, 2024 13:34
Session based cookie auth fastapi
from fastapi import Request, Depends, HTTPException, Response
from fastapi.responses import RedirectResponse
# This must be randomly generated
RANDON_SESSION_ID = "iskksioskassyidd"
# This must be a lookup on user database
USER_CORRECT = ("admin", "admin")
# This must be Redis, Memcached, SQLite, KV, etc...
@sindresorhus
sindresorhus / esm-package.md
Last active July 6, 2024 09:11
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
---
source: https://www.google.com/maps/d/viewer?mid=1Z1dI8hoBZSJNWFx2xr_MMxSxSxY&&ll=54.784654126394415%2C-8.91870626273581&z=3
last_update: Jul 23, 2019
contribute: http://bit.ly/2d13csJ
ios: http://apple.co/2b7BatI
android: http://bit.ly/2dDeaaN
how_to_update: 1. open the source in a browser
2. open browser console and type in `_pageData` to print the content of the variable
3. copy-paste all the content in a file
4. keep interesting lines with: `grep -e "name" -e "description" > new_file`
@HenningTimm
HenningTimm / rust_mem_profiling.md
Last active May 4, 2024 03:48
Memory profiling Rust code with heaptrack in 2019
@troyfontaine
troyfontaine / 1-setup.md
Last active July 5, 2024 12:18
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active July 5, 2024 16:56
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.
@ygotthilf
ygotthilf / jwtRS256.sh
Last active July 5, 2024 12:01
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@tmilos
tmilos / README.md
Last active May 13, 2024 02:36
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.