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
import javax.crypto.Mac; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.io.UnsupportedEncodingException; | |
import java.security.InvalidKeyException; | |
import java.security.NoSuchAlgorithmException; | |
public class HMAC { | |
public static void main(String[] args) throws Exception { | |
System.out.println(hmacDigest("The quick brown fox jumps over the lazy dog", "key", "HmacSHA1")); | |
} |
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 from this link: https://github.com/github/gitignore/blob/master/Android.gitignore | |
.DS_Store | |
/app/release/*.* | |
# Built application files | |
*.apk | |
*.ap_ | |
# Files for the ART/Dalvik VM |
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
branches=$(git branch | tr -d " *") | |
output="" | |
for branch in $branches | |
do | |
if [[ $branch != "develop" ]]; then | |
output="$output $branch" | |
fi | |
done | |
git branch -d $output |
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
object BitmapUtils { | |
private const val MAX_HEIGHT = 1280.0f | |
private const val MAX_WIDTH = 1280.0f | |
fun getScaledBitmap(bm: Bitmap, | |
bmOriginalWidth: Int, | |
bmOriginalHeight: Int, | |
originalWidthToHeightRatio: Double, | |
originalHeightToWidthRatio: Double, | |
maxHeight: Int, |
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
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
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
FROM adoptopenjdk/openjdk8:alpine | |
WORKDIR / | |
SHELL ["/bin/sh", "-c"] | |
RUN apk update && apk upgrade && apk add --no-cache bash git unzip wget libvirt-daemon qemu-img qemu-system-x86_64 dbus polkit virt-manager | |
# gradle caching | |
ENV GRADLE_USER_HOME=/cache |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the\
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
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
resource "aws_ecs_task_definition" "my_simple_task" { | |
family = "my-task" | |
container_definitions = <<DEFINITION | |
[ | |
{ | |
// other configurations | |
"memory": 512, | |
"cpu": 256 | |
} | |
] |
OlderNewer