Skip to content

Instantly share code, notes, and snippets.

View scsskid's full-sized avatar
:octocat:

Benedikt Gregor scsskid

:octocat:
View GitHub Profile
//Font Smoothing
//src: http://maximilianhoffmann.com/posts/better-font-rendering-on-osx
@mixin font-smoothing($value: on) {
@if $value == on {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@else {
@scsskid
scsskid / postgres.md
Last active September 1, 2021 15:28
Postgres Cheatsheet #postgres #ubuntu

psql

Connect to Database

\c [databasename]
@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 / getDataFromHtml.js
Last active September 1, 2021 14:53
[getDataFromHtml] #dom #helpers
//Src: https://github.com/swup/swup/blob/master/src/helpers/getDataFromHtml.js
import { queryAll } from '../utils';
const getDataFromHtml = (html, containers) => {
let fakeDom = document.createElement('html');
fakeDom.innerHTML = html;
let blocks = [];
for (let i = 0; i < containers.length; i++) {
@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 / youtubedl.sh
Last active June 30, 2021 10:56
[Youtube DL] #bash
# best audio
youtube-dl -f bestaudio[ext=m4a] --embed-thumbnail --add-metadata
# best video and audio
youtube-dl -f best <video link>
# If you encounter any error during the muxing process or an issue with the video quality selection, you can use one of the following commands:
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 <video link>
# optional: --yes-playlist
//src: https://github.com/swup/swup/blob/master/src/helpers/getCurrentUrl.js
const getCurrentUrl = () => {
return window.location.pathname + window.location.search;
};
export default getCurrentUrl;
@scsskid
scsskid / parse-html-form-data.js
Last active June 2, 2021 14:30
[Parse HTML FormData] #forms
function parseFormData(formData) {
const formEntries = new FormData(formData).entries();
const data = {};
for (var [formElementName, value] of formEntries) {
data[formElementName] = value;
}
return data;
}
@scsskid
scsskid / ffmpeg-receipes.sh
Last active April 15, 2021 16:56
[ffmpeg cookbook] #bash #ffmpeg
# https://stackoverflow.com/a/53269551
ffmpeg -f concat -safe 0 -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy output.mp4
# convert .mov to .mp4
# https://mrcoles.com/convert-mov-mp4-ffmpeg/
ffmpeg -i videoName.mov -vcodec h264 -acodec mp2 videoName.mp4
ffmpeg -i input.flv -vcodec libx264 -acodec aac output.mp4
@scsskid
scsskid / git-remove.sh
Created January 29, 2021 20:35
[git remove from history] #bash #git
# src: https://stackoverflow.com/a/17824718/2823589
git filter-branch --tree-filter "rm -rf node_modules" --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo node_modules/ >> .gitignore
git add .gitignore
git commit -m 'Removing node_modules from git history'
git gc
git push origin master --force