Skip to content

Instantly share code, notes, and snippets.

@jnnsrctr
jnnsrctr / csharp_vpncheck.cs
Created February 16, 2023 16:12
Method that checks if a VPN is connected
private static bool VpnCheck()
{
if (NetworkInterface.GetIsNetworkAvailable())
{
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface Interface in interfaces)
{
if (Interface.Description.Contains("Juniper Networks Virtual Adapter")
&& Interface.OperationalStatus == OperationalStatus.Up)
{
@jnnsrctr
jnnsrctr / chrome_with_vpn.bat
Last active February 16, 2023 16:06
Start Chrome, but only if the VPN is connected.
@echo off
netsh interface show interface name="Ethernet 2" ^
|find "Connect state" ^
|find "Connected">nul ^
&& start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ^
|| "C:\Program Files (x86)\Common Files\Pulse Secure\JamUI\Pulse.exe" -show
close
@jnnsrctr
jnnsrctr / XboxGamerScore.js
Last active February 5, 2023 11:38 — forked from saiteja09/XboxGamerScore.js
Widget for Yearly Xbox GamerScore Tracking for use with Scriptable app in iOS
let xbox_refreshtoken = null
let xbox_clientid = null
let xbox_clientsecret = null
let xbox_credential_base64 = null
let xbox_authorization = null
let xbox_id = null
let xbox_profileurl = 'https://peoplehub.xboxlive.com/users/me/people/xuids(<xid>)/decoration/detail,preferredColor,presenceDetail,multiplayerSummary'
let xbox_titleHistoryurl = 'https://titlehub.xboxlive.com/users/xuid(<xid>)/titles/titleHistory/decoration/GamePass,TitleHistory,Achievement,Stats'
let xbox_achievementsurl = 'https://achievements.xboxlive.com/users/xuid(<xid>)/achievements?orderBy=UnlockTime&unlockedOnly=true'
const xbox_tokenurl = 'https://login.live.com/oauth20_token.srf'