Skip to content

Instantly share code, notes, and snippets.

Avatar
🦆
Working

Yannick Spreen yspreen

🦆
Working
View GitHub Profile
View vlc-convert.sh
#!/bin/sh
vlcconvert() {
######################## Transcode the files using ... ########################
vcodec="mp4v"
acodec="mp4a"
vb="1024"
ab="128"
mux="mp4"
###############################################################################
@yspreen
yspreen / DictionaryKeyPath.swift
Last active Jul 23, 2020 — forked from dfrib/DictionaryKeyPath.swift
Swift: Reading and writing to (possible) nested dictionaries for a given key path, using a recursive approach
View DictionaryKeyPath.swift
/// This fork makes adding keys possible, on top of making it Swift 5 compatible.
import Foundation
extension Dictionary {
subscript(keyPath keyPath: String) -> Any? {
get {
guard let keyPath = Dictionary.keyPathKeys(forKeyPath: keyPath)
else { return nil }
return getValue(forKeyPath: keyPath)
}
View hammerspoon.lua
do_cut = false
fc = function()
hkc:disable()
if hs.window.focusedWindow():application():bundleID() == "com.apple.finder" then
hs.eventtap.keyStroke({"cmd"}, "C")
do_cut = false
else
hs.eventtap.keyStroke({"cmd"}, "C")
end
View index.html
<div class="container">
<span class="lead">Wohnung zur Zwischenmiete:</span>
<span class="lead bg-success ja">Noch Da!</span><br><br>
<p class="lead">
Bitte melden unter <a href="tel:+49123456789">+49 123 456789</a>
</p>
</div>
@yspreen
yspreen / egpu_wake.sh
Last active Feb 16, 2019
Automatically keep your MacBook from sleeping, when an eGPU is connected
View egpu_wake.sh
#!/bin/bash
function no_sleep {
if ! [ -n "${last_pid+x}" ]; then
caffeinate -d &
last_pid=$! &&
echo start caffeinate
fi
sleep 60
}
@yspreen
yspreen / index.html
Created Feb 10, 2019
Mars 404 Error Page
View index.html
<div class="mars"></div>
<img src="https://mars-404.templateku.co/img/404.svg" class="logo-404" />
<img src="https://mars-404.templateku.co/img/meteor.svg" class="meteor" />
<p class="title">Oh no!!</p>
<p class="subtitle">
You’re either misspelling the URL <br /> or requesting a page that's no longer here.
</p>
<div align="center">
<a class="btn-back" href="#">Back to previous page</a>
</div>
View useful.js
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();
setInterval(() => $(".icon-oj:not([src='/images/repliers/crownIcon.png'])").each(function() {$(this).parents("li").remove()}), 100);
i = setInterval(() => {return window.scrollTo(0,document.body.scrollHeight);}
, 1000);
@yspreen
yspreen / script.js
Last active Oct 30, 2018
JS snippets
View script.js
function toBin(i) {
let s = "", flip = i < 0;
i = flip ? ~i : i;
while (i != 0) {
s = (flip ? 1 - (i & 1) : (i & 1)) + s;
i >>= 1;
}
return (flip ? "…1" : "") + (s == "" ? (flip ? "1" : "0") : s);
@yspreen
yspreen / mac_change.bat
Last active Jul 19, 2018 — forked from iJos/mac_change.bat
[BAT] Randomly change the Mac Address on Windows
View mac_change.bat
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
if "%~1"=="" goto blank
set /a x=0
::Generate and implement a random MAC address
FOR /F "tokens=1" %%a IN ('wmic nic where physicaladapter^=true get deviceid ^| findstr [0-9]') DO (
@yspreen
yspreen / install_python3.sh
Last active Jul 13, 2018
Install Python 3 on Pi
View install_python3.sh
#!/bin/bash
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev -y
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
tar xf Python-3.6.5.tar.xz
cd Python-3.6.5
./configure
make -j4
sudo make install
You can’t perform that action at this time.