This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bad, if the recent backups failed, this can end up removing everything | |
find . -type f -name 'test-*' -mtime +5 -delete | |
# good, keeps 5 files at all time | |
keep=5 | |
find . -type f -name 'test-*' -printf '%T@\0%p\n' \ | |
| sort -rn \ | |
| cut -d $'\0' -f2 \ | |
| tail -n +$(( keep + 1 ) \ | |
| xargs rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import grp | |
import os | |
import pwd | |
import socket | |
import sys | |
import subprocess | |
import struct | |
import typing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ldapsearch -LLL -o ldif-wrap=no -H ldapi:/// -Y EXTERNAL -b 'cn=config' 'olcAccess=*' olcAccess \ | |
| awk '{ | |
if ($1 == "olcAccess::") { | |
command = "base64 -d -i"; print $2 | command; close(command) | |
} else { | |
print $0 | |
} | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Apache Tomcat Web Application Container | |
After=network-online.target | |
Wants=network-online.target | |
[Service] | |
User=tomcat | |
Group=tomcat | |
WorkingDirectory=/opt/tomcat-9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var htmlLoaded = false; | |
var imgLoaded = false; | |
var pic = new Image; | |
pic.onload = function() { | |
imgLoaded = true; | |
load(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mount="/home/bendem/nas-samba" | |
d=`date +"%H:%M:%S %d-%m-%Y"` | |
echo "Backup task running $d" | |
# Skip if not mounted | |
grep -qs "$mount" /proc/mounts | |
if [ $? -ne 0 ]; then | |
echo "Skipping..." | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Enum = function(values, methods) { | |
var created = {}; | |
var EnumValue = function(value) { | |
this.value = value; | |
} | |
if(methods) { | |
for(var name in methods) { | |
EnumValue.prototype[name] = methods[name]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple ajax thing to send stuff | |
// @param url string | |
// @param success callback | |
// @param method string (optional) | |
// @param data plainobject (optional) | |
function ajax(url, success, method, data) { | |
var xhr = new XMLHttpRequest(); | |
// Set the callback to use when all the stuff is done | |
xhr.onreadystatechange = function() { | |
// We are not interested in the 3 other stages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package be.bendem.testing.utils; | |
public class ColorUtils { | |
private ColorUtils() {} | |
public static int[] decompose(int color) { | |
int[] rgb = new int[3]; | |
rgb[0] = color >> 16 & 0xFF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Glowstone Testing</title> | |
<!--<script src="/bundles/modernizr?v=qVODBytEBVVePTNtSFXgRX0NCEjh9U_Oj8ePaSiRcGg1"></script>--> | |
<!--<link rel="stylesheet" href="/Content/css/Glowstone.css">--> | |
<link rel="stylesheet" href="style.css"> | |
<script src="http://glowstone.turt2live.com/bundles/jquery?v=JzhfglzUfmVF2qo-weTo-kvXJ9AJvIRBLmu11PgpbVY1"></script> |
NewerOlder