Skip to content

Instantly share code, notes, and snippets.

View scsskid's full-sized avatar
:octocat:

Benedikt Gregor scsskid

:octocat:
View GitHub Profile
@scsskid
scsskid / getScrollBarWidth.ts
Created October 22, 2023 11:32
getScrollBarWidth
export default function getScrollbarWidth() {
// Creating invisible container
const outer = document.createElement("div");
outer.style.visibility = "hidden";
outer.style.overflow = "scroll"; // forcing scrollbar to appear
// @ts-ignore
outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
document.body.appendChild(outer);
#!/bin/sh
# This script generates a ssh key for a single repository
# and adds a custom configuration to the users (not global) ssh config file,
# and outputs the public key for you to copy and paste as the repo deploy key
# and outputs the url for you to clone the repo on the machine.
# Github docs ref:
# https://docs.github.com/en/developers/overview/managing-deploy-keys#using-multiple-repositories-on-one-server
#
# 1. Add the script to the user account of the machine. The home directory is fine.
# 2. Make the script executable by running the following command as the user:
sup {
vertical-align: baseline;
font-feature-settings: "sups";
font-size: 1em;
}
sub {
vertical-align: baseline;
font-feature-settings: "subs";
font-size: 1em;
}
@scsskid
scsskid / generate-deploy-key.sh
Created March 5, 2023 19:41
generate deploy key
#!/bin/sh
# This script generates a ssh key for a single repository
# and adds a custom configuration to the users (not global) ssh config file,
# and outputs the public key for you to copy and paste as the repo deploy key
# and outputs the url for you to clone the repo on the machine.
# Github docs ref:
# https://docs.github.com/en/developers/overview/managing-deploy-keys#using-multiple-repositories-on-one-server
#
# 1. Add the script to the user account of the machine. The home directory is fine.
# 2. Make the script executable by running the following command as the user:
@scsskid
scsskid / nginx-reverse-proxy.md
Last active September 15, 2021 16:19
Nginx Reverse Proxy Config Docker Wordpress #ubuntu #docker #nginx

Nginx Reverse Proxy

Sample Config from wordpress project

server {
  listen        80;
  server_name   v2.benedikt.gr;

 location / {
@scsskid
scsskid / tools.md
Last active September 12, 2021 11:31
network-tools
@scsskid
scsskid / inline-svg-function.scss
Created September 1, 2021 15:37 — forked from JacobDB/inline-svg-function.scss
Inline SVG function [SASS]
// Replace letters
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@scsskid
scsskid / README.md
Last active September 1, 2021 15:28 — forked from sutlxwhx/README.md
How to backup your LAMP / LEMP installation the right way #bash #ubuntu

Introduction

This is the LAMP / LEMP environment backup guide in case you want or need to try my highload LEMP installation.

Basic usage

As a first thing we will setup a variable that will store current date and time. We will use year-month-day_hours-minutes-seconds format:

now=$(date +"%Y-%m-%d_%H-%M-%S")
@scsskid
scsskid / run-pg-pgadmin.sh
Created August 14, 2021 13:29
[Temp Spin Up pg and pgadmin in Docker] #docker #bash
docker pull postgres
docker pull dpage/pgadmin4
docker run \
--name temppg \
--net database_default \
-p 54332:5432 \
-e 'POSTGRES_USER=root' \
-e 'POSTGRES_PASSWORD=root' \
-e 'POSTGRES_DB=testtest' \
@scsskid
scsskid / git-disable-pager.md
Last active September 1, 2021 18:36
git disable default pager config | #git

Disable Pager

for git diff or other commands
--global is optional

git config --global pager.diff false