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
#!/bin/sh | |
# small tool to make du default to -h and -d1 | |
# also to sort output | |
if [ "$#" -ne 1 ]; then | |
du -hd1 . | sort -h; | |
else | |
du -h $@ | sort -h; | |
fi |
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
public static <ENUM_KIND extends Enum<?>> ENUM_KIND rndEnum(final Class<ENUM_KIND> enumType) { | |
final ENUM_KIND[] enumValues = enumType.getEnumConstants(); | |
if (enumValues.length > 0) { | |
int rnd = new Random().nextInt(enumValues.length); | |
return enumValues[rnd]; | |
} else { | |
// yeah, ok.. nobody knows that kind of exception | |
// do something else instead | |
throw EnumNotImplementedException.of(enumType); | |
} |
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 reduceSpecialChars = function(input) { | |
let normalized = input.toLocaleLowerCase().normalize("NFKD"); | |
normalized = normalized.replace("ß","ss"); | |
bytes = []; | |
for (var i = 0; i < normalized.length; ++i) | |
{ | |
charCode = normalized.charCodeAt(i); | |
bytes.push(charCode & 0xFF); | |
} | |
temp = ""; |
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 reduceSpecialChars = function(input) { | |
let normalized = input.normalize("NFKD"); | |
normalized = normalized.replace("ß","ss"); | |
bytes = []; | |
for (var i = 0; i < normalized.length; ++i) | |
{ | |
charCode = normalized.charCodeAt(i); | |
bytes.push(charCode & 0xFF); | |
} | |
temp = ""; |
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
function change(strZahl){ | |
// Mögliche Dezimalstellen auf 2 Stellen runden und Dez-Punkt durch Komma ersetzen | |
strZahl = String(Number(strZahl).toFixed(2)).replace(/\./,","); | |
// Solange noch mindestens vier Ziffern am Anfang gefunden werden | |
while(strZahl.match(/^(\d+)(\d{3}\b)/)){ | |
// Tausendertrennzeichen einfügen | |
strZahl = strZahl.replace(/^(\d+)(\d{3}\b)/, RegExp.$1 + "." + RegExp.$2); | |
} | |
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
################## | |
# Privacy Settings | |
################## | |
# Privacy: Let apps use my advertising ID: Disable | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0 | |
# To Restore: | |
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1 | |
# Privacy: SmartScreen Filter for Store Apps: Disable | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 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
# Description: Boxstarter Script | |
# Author: Jess Frazelle <[email protected]> | |
# Last Updated: 2017-09-11 | |
# | |
# Install boxstarter: | |
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force | |
# | |
# You might need to set: Set-ExecutionPolicy RemoteSigned | |
# | |
# Run this boxstarter by calling the following from an **elevated** command-prompt: |
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
x = function(foo) { console.log(arguments.callee.name) }; | |
x("test") | |
> x | |
y = function(func) { func("bar") } | |
y(x) | |
> x | |
z = x | |
z() |
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
/** | |
* Parses complex HTML-Templates and inserts vars from a dictionary | |
* Simple Example: | |
* Template: "<p>Hello, my name is <%name%>. I\'m <%age%> years old.</p>" | |
* Options: {name: 'foobar', age: 23} | |
* | |
* More complex example: | |
* Template: "<% if(this.flowers.length > 0) { %> | |
* <ul> | |
* <% for(var i in this.flowers) { %> |
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
/** | |
* Parses complex HTML-Templates and inserts vars from a dictionary | |
* Simple Example: | |
* Template: "<p>Hello, my name is <%name%>. I\'m <%age%> years old.</p>" | |
* Options: {name: 'foobar', age: 23} | |
* | |
* More complex example: | |
* Template: "<% if(this.flowers.length > 0) { %> | |
* <ul> | |
* <% for(var i in this.flowers) { %> |
NewerOlder