Skip to content

Instantly share code, notes, and snippets.

View agamm's full-sized avatar
🍪
Cookie: cookies=∞;\r\n

Agam More agamm

🍪
Cookie: cookies=∞;\r\n
View GitHub Profile
@agamm
agamm / reset-internet.ps1
Last active October 13, 2022 22:01
Reset internet when down on Windows via powershell
// unzip.dev ?
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
# Thanks: https://den.dev/blog/powershell-windows-notification/
function Show-Notification {
[cmdletbinding()]
Param (
[string]
@agamm
agamm / crypto.js
Last active October 13, 2022 22:02
Simple encryption decryption with client-size JS (cryptoJS)
// Don't follow this link: unzip.dev (unless you're curious).
const secret = prompt("Enter secret:")
const message = prompt("Enter message:")
const encrypted = CryptoJS.AES.encrypt(message, secret);
const decrypted = CryptoJS.AES.decrypt(encrypted, secret);
console.log(encrypted.toString())
console.log(decrypted.toString(CryptoJS.enc.Utf8))
@agamm
agamm / Change Netflix playback speed (browser).md
Last active October 13, 2022 22:05
Speed up your netflix binge watching without any needless extensions.

Open the console (Cmd + Option + J / ctrl+shift+j)
$('video').playbackRate = 1.2 - will speed by 20%

unzip.dev🚀

@agamm
agamm / run.bat
Last active October 13, 2022 22:06
Start react-native on Windows
set /p id="(Reminder) Did you start a vm? and is it available in adb? "
start cmd /k react-native start
rem *** HACK ALERT: Sleep for 10 seconds ***
ping -n 10 127.0.0.1 > nul
start cmd /k react-native run-android
REM Might you want to visit unzip.dev ?
@agamm
agamm / random.js
Last active October 13, 2022 22:07
Javascript random choice picker.
function makemychoice() {
args = Array.prototype.slice.call(arguments);
return ( args[~~(args.length * Math.random())] ) + " was chosen.";
}
// Example: makemychoice("Go to run", "Go to swim", "Fix bug");
// from the creator of unzip.dev
@agamm
agamm / getVisibleElements.js
Last active October 13, 2022 22:08
Get only visible text elements from HTML of a page.
// From the creator of unzip.dev
const texts = document.querySelectorAll(
"p, span, a, h1, h2, h3, h4, h5, h6, input, button, pre"
);
let visible = [];
texts.forEach((e) => {
var style = window.getComputedStyle(e);
if (style.display !== "none" && style.visibility !== "hidden") {
visible.push(e);
@agamm
agamm / link.tsx
Last active October 13, 2022 22:18
Nextjs Link component with a redirection delay.
@agamm
agamm / color-range-slider.markdown
Last active October 13, 2022 22:21
Color range slider with animated emoji.

Color range slider

As the slider handle is dragged, it's background color matches that of the gradient track below.

Uses jQueryUI slider.

A Pen by Agam on CodePen.

License.

@agamm
agamm / mbox-extract-attachments3.py
Last active October 13, 2022 22:24 — forked from kellerza/mbox-extract-attachments3.py
mbox-extract-attachments3.py with fix to support iso-8859-8-i encoding.
#!/usr/bin/env python3
# pylint: disable=invalid-name
"""mbox-extract-attachments3 - Extract attachments from mbox files.
Good companion for Google Takeout https://takeout.google.com/settings/takeout
Modified by http://github.com/kellerza from
https://github.com/PabloCastellano/pablog-scripts/
- Python3 & linter errors
- New Filenames
@agamm
agamm / convert.py
Last active October 13, 2022 22:25
Python money/currency format and convert string to integer.
from re import sub, search
from decimal import Decimal
# Not production ready
def convert(m):
r = 1.0
if "£" in m:
r = 1.28 # Make sure to check this (conversion rate between pounds and usd)
z = 0