$ uname -r
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
/** | |
* Basic error-prone function for prettifying (formatting) a lombok @ToString output | |
* Fails for data containing [](),= | |
* Can be improved by adding lookarounds from each switch-case (checking for '=' behind) | |
* Replace me with objectmapper and json + jsonprettyprint? | |
* | |
* @param str a string generated by lombok @ToString | |
* @return pretty formatted lombok object | |
*/ | |
private static String prettyPrintLombokToString(String str) { |
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 geohash instead! | |
function encodePositiveFloat(number) { | |
return compressInt(number | |
.toString() | |
.indexOf('.') | |
.toString() | |
.concat(number | |
.toString() | |
.replace(".", ""))); |
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
/** | |
* Add X working days to a LocalDateTime | |
* | |
* @param startingDate | |
* @param workingDaysToAdd | |
* @return First working day after LocalDateTime with working days added | |
*/ | |
public static LocalDateTime addWorkingDays(LocalDateTime startingDate, int workingDaysToAdd) { | |
int days = 0; | |
int workingDays = 0; |
Add &feature=mfu_in_order&list=UL
behind current video URL
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 getValuesAndCurrencies(message) { | |
var regex = /([$|€|£])? ?(\d+(?:[,.]\d{1,2})?) ?(k)? ?\b(NOK|SEK|USD|CAD|EUR|GBP)?\b/gi; | |
var symbolToCurrency = { "$": "USD", "€": "EUR", "£": "GBP" }; | |
var match, value, currency; | |
var result = []; | |
while (match = regex.exec(message)) { | |
value = parseFloat(match[2].replace(",", ".")) * (match[3].toLowerCase() == "k" ? 1000 : 1); | |
currency = (match[4] || symbolToCurrency[match[1]]) || ""; | |
result.push([value, currency]); | |
} |
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
@REM Just run this in cmd replacing the IP | |
FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /i "Reply">>c:\temp\ipaddresses.txt |
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
powercfg -lastwake |
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
Get-Content -Path <Filepath> -Wait |
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 cdStamp = 1472301000000; | |
var cdDuration = cdStamp - (new Date().getTime()); | |
cdDuration = cdDuration > 0 ? cdDuration : 0; | |
var cdTimes = [ 7, 24, 60, 60, 1000]; | |
var cdUnit = ['uke', 'dag', 'time', 'minutt', 'sekund']; | |
var cdUnitEnd = [ 'r', 'er', 'r', 'er', 'er']; | |
var cdResult = cdTimes | |
.map((t, i, timeArr) => { | |
var unitMulti = timeArr.slice(i, timeArr.length).reduce((a,b) => a*b); |
NewerOlder