Skip to content

Instantly share code, notes, and snippets.

Avatar

TheGreatCabbage

View GitHub Profile
@nijave
nijave / metered.ps1
Created Jun 23, 2019
Powershell check if on metered network
View metered.ps1
[void][Windows.Networking.Connectivity.NetworkInformation, Windows, ContentType = WindowsRuntime]
$cost = [Windows.Networking.Connectivity.NetworkInformation]::GetInternetConnectionProfile().GetConnectionCost()
$cost.ApproachingDataLimit -or $cost.OverDataLimit -or $cost.Roaming -or $cost.BackgroundDataUsageRestricted -or ($cost.NetworkCostType -ne "Unrestricted")
@praseodym
praseodym / AESGCMUpdateAAD2.java
Last active Apr 14, 2021
JDK8 AES-GCM code example
View AESGCMUpdateAAD2.java
import javax.crypto.*;
import javax.crypto.spec.GCMParameterSpec;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import java.util.Arrays;
public class AESGCMUpdateAAD2 {
// AES-GCM parameters
public static final int AES_KEY_SIZE = 128; // in bits