Skip to content

Instantly share code, notes, and snippets.

@mrkskwsnck
mrkskwsnck / .bash_profile
Last active April 23, 2024 13:36
Customized bash prompt for Git's sake
source ~/.profile
# Customized terminal prompt to reflect current git branches. Based on Debian's default PS1 variable, which was
# e.g. '\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# at the time beeing of Debian 12 Bookworm. The original prompt was broken in two parts (left and right)
# and it can get flavoured with the middle part, to your very linking.
#
# Left part: ${PS1:0:-3}
# Right part: ${PS1:${#ps1_left_part}:${#PS1}}
#
@mrkskwsnck
mrkskwsnck / Skip YouTube Ads.js
Created December 30, 2022 12:17 — forked from kwasmich/Skip YouTube Ads.js
Script for Userscripts browser extension to skip ads on Youtube.
// ==UserScript==
// @name Skip YouTube Ads
// @description This is your new file, start writing code
// @match *://*.youtube.com/*
// ==/UserScript==
function skipAd() {
const adPlaying = document.body.querySelector(".ad-showing");
if (!adPlaying) {
# Description: Rename argument files of taken photos (JPG) and videos (AVI) to a Nextcloud compatible timestamp format.
#
# Author: Markus Kwaśnicki
#
# Prerequisites:
# * { Install-Module -Name ExifDateTime -Scope CurrentUser }
# * { Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser }
#
# Setup: Create shortcut to
# `"C:\Program Files\PowerShell\7\pwsh.exe" -WindowStyle Hidden -File "%USERPROFILE%\Documents\PowerShell\Scripts\Rename-FotofallenFotos.ps1"´ inside
@mrkskwsnck
mrkskwsnck / renmove_zero-conflicted_files.sh
Created August 21, 2022 16:28
Search synchronized files conflicted by Nextcloud and replace the original file if it is zero sized.
#!/usr/bin/bash
# Search synchronized files conflicted by Nextcloud and
# replace the original file if it is zero sized.
START_DIR="$1"
GLOB_PATTERN=' (conflicted copy ????-??-?? *)'
REGEX_PATTERN=' \(conflicted copy [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]+\)'
OLDIFS=$IFS
@mrkskwsnck
mrkskwsnck / README.md
Last active November 5, 2021 16:40
Example read me file by Golo Roden

<Add module name here>

<Add module description here>

Installation

$ npm install <Add module name here>
@mrkskwsnck
mrkskwsnck / http_proxy_extra_header_demo.php
Created February 26, 2021 10:39
Extra HTTP header from proxy
<?php
/*
* Description: Demonstration of the "extra HTTP header" issue using a
* web proxy. The problem becomes significant when the
* header is output with the body alltogether.
*
* Solution: See https://stackoverflow.com/a/17059693/3375584
*/
@mrkskwsnck
mrkskwsnck / powertest.sh
Last active August 12, 2019 13:45
Test the Raspberry Pi's power supply for stability
#!/bin/bash
#
# Description: Test the Raspberry Pi's power supply for stability
# Source: https://github.com/bamarni/pi64/issues/4#issuecomment-292707581
#
# Watch your Pi! RPi foundation knows that Micro USB for DC-IN
# is sh*t but also doesn't give a sh*t. Voltage drops caused by
# average USB cables cause all sorts of instabilities and also
# data corruption but instead of fixing the problem they masked
# it in their 'firmware'. The main CPU on the Raspberry monitors
@mrkskwsnck
mrkskwsnck / index.html
Created November 28, 2018 12:56
HTML dummy file (Flipping Tables)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Flipping Tables</title>
</head>
<body>
<p>(╯°□°)╯︵ ┻━┻</p>
</body>
</html>
@mrkskwsnck
mrkskwsnck / update_all_repos.lua
Created September 29, 2017 10:08
Iterate over all user's GitHub repositories and update them locally
#!/usr/bin/env lua
--[[
Dependencies via Luarocks:
* luasocket
* luasec
* luajson
* luafilesystem
@mrkskwsnck
mrkskwsnck / README.md
Created March 26, 2016 15:33 — forked from trieloff/README.md
A command line alternative to LampStealer

The LampStealer app for Hue does not work with newer versions of the bridge, as the API has changed. This shell script works with fewer dependencies and achieves the same. Install jq and run the shell script after pushing the big button on the bridge.