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 | |
metaflac --remove --block-type=PICTURE *.flac |
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 | |
for f in *.flac; do ffmpeg -i "$f" -acodec alac -ar 96000 "${f%.flac}.m4a"; done |
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 | |
metaflac --import-picture-from="image.jpg" *.flac |
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 | |
for f in *.m4a; do atomicparsley "$f" --artwork "image.jpg" --overWrite; done |
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 | |
mysqldump -h host -u username -p --compress --single-transaction databasename | gzip > /tmp/databasename.sql.gz |
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 | |
mysqldump -h 127.0.0.1 -u username -p --single-transaction databasename | gzip > /tmp/databasename.sql.gz |
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 void createQRCode(String barCodeData, String filePath, int height, int width) | |
throws WriterException, IOException { | |
BitMatrix matrix = new MultiFormatWriter().encode(barCodeData, BarcodeFormat.QR_CODE, | |
width, height); | |
try (FileOutputStream out = new FileOutputStream(filePath)) { | |
MatrixToImageWriter.writeToStream(matrix, "png", out); | |
} | |
} |
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 String getGoogleAuthenticatorBarCode(String secretKey, String account, String issuer) { | |
String normalizedBase32Key = secretKey.replace(" ", "").toUpperCase(); | |
try { | |
return "otpauth://totp/" | |
+ URLEncoder.encode(issuer + ":" + account, "UTF-8").replace("+", "%20") | |
+ "?secret=" + URLEncoder.encode(normalizedBase32Key, "UTF-8").replace("+", "%20") | |
+ "&issuer=" + URLEncoder.encode(issuer, "UTF-8").replace("+", "%20"); | |
} catch (UnsupportedEncodingException e) { | |
throw new IllegalStateException(e); | |
} |
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
<dependency> | |
<groupId>com.google.zxing</groupId> | |
<artifactId>javase</artifactId> | |
<version>3.2.1</version> | |
</dependency> |
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
String secretKey = "quu6 ea2g horg md22 sn2y ku6v kisc kyag"; | |
String lastCode = null; | |
while (true) { | |
String code = getTOTPCode(secretKey); | |
if (!code.equals(lastCode)) { | |
// output a new 6 digit code | |
System.out.println(code); | |
} | |
lastCode = code; | |
try { |
NewerOlder