Skip to content

Instantly share code, notes, and snippets.

@martok
martok / Yt-nogrid.user.js
Created February 25, 2024 22:45
Reset Youtube 2024 "Grid" Layout
// ==UserScript==
// @name Yt-nogrid
// @namespace http://scripts.martoks-place.de/yt-grid
// @include *://*.youtube.com/*
// @version 1
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
@martok
martok / colorpages.py
Last active March 26, 2023 16:36
Count Color/BW pages in PDF
import argparse
import sys
from pathlib import Path
import subprocess
import tempfile
import cv2
import numpy as np
GS = r"gswin64c.exe"
@martok
martok / opt-ruby.sh
Last active April 7, 2020 11:52
Ruby source installation manager
#!/bin/bash
CONF=/etc/profile.d/optruby.sh
INSTALLED=/opt/ruby
do_status() {
current=$(OPTRUBY=system ; [ -f $CONF ] && . $CONF ; echo $OPTRUBY )
echo "Currently enabled version via profile.d: $current"
echo "Currently selected by this shell: $(ruby -v)"
}
#include <iostream>
using namespace std;
/*
template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
static inline bool set_in(T val, T a1, T a2) { return (val==a1||val==a2); }
template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
static inline bool set_in(T val, T a1, T a2, T a3) { return (val==a1||val==a2||val==a3); }
template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
static inline bool set_in(T val, T a1, T a2, T a3, T a4) { return (val==a1||val==a2||val==a3||val==a4); }
@martok
martok / systemdTOTD.markdown
Last active December 26, 2021 11:18
systemdTOTD archive

Meta

This is @LucasWerkmeistr's #systemdTOTD thread, gathered using Spooler and reposted here with only some typographic adjustments by me.

Part 1

Alright everyone, how about some systemd Tip Of The Day goodness?

@martok
martok / 122032.css
Created July 1, 2018 12:30
YouTube Real Cinema Mode
@-moz-document domain(youtube.com) {
body {
overflow-x: hidden;
}
#masthead-positioner {
z-index: 10;
}
.watch-stage-mode #player .player-api {
@martok
martok / mpinice.sh
Created March 28, 2018 15:03
Start a program using mpirun with multi-user-friendly options
#!/bin/bash
{
NPROCS=4
NICE=10
STDOUT=/dev/stdout
print_usage()
{
cat <<END
units metal
dimension 3
boundary p p p
atom_style atomic
timestep 0.001
variable min2th index 20
variable max2th index 90
lattice bcc 3.147
@martok
martok / Al.meam
Created June 15, 2017 11:14
Testcase LAMMPS MEAM/C #1
Cmin(1,1,1) = 1
repuls(1,1) = 0.4770183040558415
nn2(1,1)=1
rc = 5.0
ialloy=1
augt1=0
delr=1
emb_lin_neg=1
bkgd_dyn=1
@martok
martok / syncrotron.cmd
Created April 17, 2017 22:05
Sync/Backup script based on Robocopy
@echo off
setlocal
echo ************************************************
echo **** Martok's Syncrotron ****
echo ************************************************
echo **** 1: Copy from this machine to exHDD ****
echo **** 2: Copy from exHDD to this machine ****
echo **** anything else: exit ****
echo ************************************************
set /p select="Choose option: "