Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Andreas Sander andi1984

🏠
Working from home
View GitHub Profile
@andi1984
andi1984 / nav.json
Last active Mar 17, 2021
test nav.json
View nav.json
{
"private": {
"links": [
{ "label": "Twitter", "url": "http://www.twitter.com" },
{ "label": "Mastodon", "url": "http://social.saarland" },
{ "label": "LinkedIn", "url": "https://www.linkedin.com/"},
{ "label": "Geizhals", "url": "https://geizhals.de/"},
{ "label": "MyDealz", "url": "https://www.mydealz.de/"},
{ "label": "Wetter", "url": "https://www.wetter.com/"},
{ "label": "Raindrop", "url": "https://app.raindrop.io/"},
View demo.js
/**
* @typedef {import("./typings").Car} Car
*/
/**
* @type {Car}
*/
const porsche993 = {};
View docker
#!/bin/bash# Delete all containersdocker
rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)# Prune unused volumesdocker volume prune
View ffmpeg-compression
# https://unix.stackexchange.com/a/38380
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
@andi1984
andi1984 / lint.css
Last active Jul 7, 2020
Lint HTML CSS #lintHTMLwithCSS
View lint.css
/* forbidden nesting */
:not(figure) > figcaption,
:not(fieldset) > legend,
:not(dl) > :is(dt, dd),
:not(tr) > :is(td, th),
:not(select) > :is(option, optgroup),
:not(table) > :is(thead, tfoot, tbody, tr, colgroup, caption) {
outline: 2px dotted red;
}
@andi1984
andi1984 / lambda.py
Created May 7, 2020
Lambda - Bitbucket, change PR description
View lambda.py
import json
from botocore.vendored import requests
import os
def lambda_handler(event, context):
payload = json.loads(event['body'], encoding='utf8')
title = payload["pullrequest"]["title"]
description = payload['pullrequest']['description']
with open('checklist.txt') as f:
extra_text = f.read()
@andi1984
andi1984 / 1-easy.js
Created Jan 6, 2020 — forked from nybblr/1-easy.js
3 examples of using Async Generators and Async Iteration in JavaScript!
View 1-easy.js
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {
@andi1984
andi1984 / netlify.toml
Created Jun 13, 2019
Example netlify config
View netlify.toml
# Settings in the [build] context are global and are applied to all contexts
# unless otherwise overridden by more specific contexts.
[build]
# Directory to change to before starting a build.
# This is where we will look for package.json/.nvmrc/etc.
base = "project/"
# Directory (relative to root of your repo) that contains the deploy-ready
# HTML files and assets generated by the build. If a base directory has
# been specified, include it in the publish directory path.
@andi1984
andi1984 / save-file-local.js
Created Nov 15, 2018 — forked from liabru/save-file-local.js
Save a text file locally with a filename, by triggering a download in JavaScript
View save-file-local.js
/*
* Save a text file locally with a filename by triggering a download
*/
var text = "hello world",
blob = new Blob([text], { type: 'text/plain' }),
anchor = document.createElement('a');
anchor.download = "hello.txt";
anchor.href = (window.webkitURL || window.URL).createObjectURL(blob);
@andi1984
andi1984 / shell.sh
Created Sep 29, 2018
Mastodon - Fix folder permissions
View shell.sh
sudo docker-compose run --rm -u root web chown -R mastodon:mastodon public/assets public/packs public/system