Skip to content

Instantly share code, notes, and snippets.

Sebastian Hütter martok

Block or report user

Report or block martok

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3bc302651b318861425897e67319fc18
#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 Jan 2, 2019
systemdTOTD archive
View systemdTOTD.markdown

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 Jul 1, 2018
YouTube Real Cinema Mode
View 122032.css
@-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 Mar 28, 2018
Start a program using mpirun with multi-user-friendly options
View mpinice.sh
#!/bin/bash
{
NPROCS=4
NICE=10
STDOUT=/dev/stdout
print_usage()
{
cat <<END
View xrd_mo.lmp
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 Jun 15, 2017
Testcase LAMMPS MEAM/C #1
View Al.meam
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 Apr 17, 2017
Sync/Backup script based on Robocopy
View syncrotron.cmd
@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: "
View gist:6f855c8887fd4f33454d
<?php
define('IND','&nbsp;&nbsp;');
function hex2bin( $str ) {
$sbin = "";
$len = strlen( $str );
for ( $i = 0; $i < $len; $i += 2 ) {
$sbin .= pack( "H*", substr( $str, $i, 2 ) );
}
@martok
martok / counter.py
Created Jan 13, 2015
MCEdit Block/Height filter
View counter.py
from pymclevel import items
def itembyname(name):
if name in items.items.items:
return items.items.itewms[name]["id"]
return 0
def namebyitem(id):
item = items.items.findItemID(id)
if type(item["name"]) == str or type(item["name"]) == unicode:
@martok
martok / SystemExceptionHandling.pas
Created Sep 10, 2013
Custom exception handler for use with FPC
View SystemExceptionHandling.pas
unit SystemExceptionHandling;
// Inspired by what is described at FPC's forums:
// http://bugs.freepascal.org/view.php?id=12974 [^]
//
// especially in comment 0040683 by Bernd Kreuss
{$mode objfpc}{$H+}
{$AsmMode intel}
You can’t perform that action at this time.