Skip to content

Instantly share code, notes, and snippets.

@ikorchynskyi
ikorchynskyi / dataview-polyfill.js
Created October 1, 2015 09:44
DataView (and ArrayBuffer) polyfill that works in any engine (including old IE).
void function(global){
if ('DataView' in global && 'ArrayBuffer' in global) {
return;
}
var hide = (function(){
// check if we're in ES5
if (typeof Object.getOwnPropertyNames === 'function' && !('prototype' in Object.getOwnPropertyNames)) {
var hidden = { enumerable: false };

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

@ikorchynskyi
ikorchynskyi / cwl-last-used.sh
Created May 26, 2021 09:01 — forked from jsyi/cwl-last-used.sh
Use AWS CLI to query AWS CloudWatch Logs and determine the most recent entry into a Log Group
aws logs describe-log-groups | jq ".logGroups[].logGroupName" | grep -E "homeplus|mcdonalds" | xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor" | xargs -t -n 1 date -r
# aws logs describe-log-groups | jq ".logGroups[].logGroupName"
# Get LogGroup names
# grep -E "homeplus|mcdonalds"
# (Optional) Filter LogGroup names
# xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor"
# Get last event timestamp for each LogGroup.
#!/usr/bin/env python
import argparse
import re
import datetime
import ipaddress
import os
import sys
def get_iface_networks(dev):
@ikorchynskyi
ikorchynskyi / pre-push.sh
Created May 28, 2021 13:26 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@ikorchynskyi
ikorchynskyi / android-backup-apk-and-datas.md
Created August 8, 2021 13:03 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Fetch application APK

To get the list of your installed applications:

@ikorchynskyi
ikorchynskyi / delete_all_object_versions.sh
Created August 9, 2021 12:20 — forked from weavenet/delete_all_object_versions.sh
Delete all versions of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@ikorchynskyi
ikorchynskyi / README.md
Created November 13, 2021 21:04 — forked from lenosi/README.md
MIUI bloatware

Get list of system apps on the device:

adb shell "echo 'apps:' && pm list packages -f | grep /system/app/ | sed 's/.*=/  - /'"

Remove application command

pm uninstall -k --user 0 app
@ikorchynskyi
ikorchynskyi / 01.bash_shortcuts_v2.md
Created December 16, 2021 10:57 — forked from tuxfight3r/01.bash_shortcuts_v2.md
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@ikorchynskyi
ikorchynskyi / Dockerfile
Created June 1, 2023 13:27
Dockerfile example
# syntax=docker/dockerfile:1
ARG GRADLE_VERSION=8
ARG JDK_VERSION=17
ARG UBUNTU_CODENAME=jammy
ARG SOURCE_DIR=/home/jenkins
ARG UID=1000
ARG GID=1000
ARG APP_FAMILY=family
ARG APP_NAME=app