Skip to content

Instantly share code, notes, and snippets.

View mavaddat's full-sized avatar
🏠
Working from home

Mavaddat Javid mavaddat

🏠
Working from home
View GitHub Profile
@mavaddat
mavaddat / .gitignore
Created July 12, 2019 19:28 — forked from VonC/.gitignore
Simple download and installation script, which can be called from the cloud
/senv.sublime-*
/WindowTabsSettings.txt
@mavaddat
mavaddat / Java-CompileRun.ps1
Last active September 7, 2019 01:50
This creates a parameterized PowerShell function for compiling and running Java applications in .java files.
function Java-CompileRun {
Param(
[Parameter(Mandatory=$true)]
[String]
$javaFile,
[Parameter(Mandatory=$false)]
[String]
$path=$PWD,
[Parameter(Mandatory=$false)]
[String]
@mavaddat
mavaddat / compileRun.sh
Last active November 23, 2019 23:27
This implements a bash function (GNU Bash or Bourne-again shell) that compiles and runs a target java class (with attendant .java file). It assumes your target exists somewhere in $GITHUB_PATH
#!/bin/bash
readonly GITHUB_PATH=~/Documents/GitHub
function compileRun () {
r () {
if [ $1 -eq 0 ]
then #compiled successfully
java $2
return 0
else #compile failed
@mavaddat
mavaddat / getDependencies.ps1
Last active October 16, 2019 02:59
Preliminary version of a PowerShell script to get the .jar dependencies for a java build
function Get-Dependencies {
[CmdletBinding()]
param (
[Alias("CP", "ClassPath")]
[Parameter(Mandatory = $false)]
[string] ${Class-Path} = "F:\lwjgl-release-3.2.3-custom\",
[Alias("File", "JavaFile", "Target")]
[Parameter(Mandatory = $true)]
${Target-JavaFile}
@mavaddat
mavaddat / QuantcastChoice.html
Last active July 3, 2020 04:06
Obtain and manage consumer consent for GDPR across digital ecosystem with Quantcast Choice. Details here: https://help.quantcast.com/hc/en-us/articles/360047075914-Choice-Universal-Tag-Implementation
<!-- Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) -->
<script type="text/javascript" async="true">
(function() {
var host = window.location.hostname;
var element = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
var milliseconds = new Date().getTime();
var url = 'https://quantcast.mgr.consensu.org'
.concat('/choice/', 'DffhEACkSgqrA', '/', host, '/choice.js')
.concat('?timestamp=', milliseconds);
@mavaddat
mavaddat / exampleAfter.srt
Last active January 18, 2020 01:13
Regular expression to remove redundant captioning in extracted captions from YouTube videos. The search is in regex. The replacement group is $2. The target caption file should be in SRT format. SubRip Subtitle files (SRT) are plain-text files that contain subtitle information. They include start and stop times next to the subtitle text, ensurin…
1
00:00:01,168 --> 00:00:02,702
INSTALL A LOYALIST AS THE
2
00:00:02,703 --> 00:00:03,703
DIRECTOR OF NATIONAL
3
00:00:03,704 --> 00:00:04,904
@mavaddat
mavaddat / Ask-YesOrNo.ps1
Created January 30, 2020 22:51
Ask user for confirmation. Function allows you to ask for confirmation. It is written by @hugopeeters
# Description: Ask a user to answer a question with either yes or no.
# Example use:
# If (Ask-YesOrNo)
# {
# # User has confirmed
# ...
# }
# Else
# {
####### License: MIT
"""MIT License
Copyright (c) 2020 Mavaddat Javid and Aaron Hall
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mavaddat
mavaddat / repairVSLiveShare.ps1
Last active August 9, 2021 18:26
Fix VS LiveShare extensions using completely new install. This is a more aggressive, hard reset than just uninstalling and reinstalling because it also recursively deletes the extension cache and global storage directories before reinstalling.
# Get the VS Code batch script
$vsCodeCmd = Get-Command -Name code*cmd -CommandType Application -TotalCount 1
# Verify code sign
$vsCodeExe = Resolve-Path "$(Join-Path ($vsCodeCmd| Get-Item).Directory '..')\Code*.exe"
if( $null -eq $vsCodeExe -or ((Get-AuthenticodeSignature -FilePath $vsCodeExe -ErrorAction Stop).Status -ne [System.Management.Automation.SignatureStatus]::Valid)){
throw "Could not find valid VS Code Executable."
}
# Collect all the liveshare extensions
@mavaddat
mavaddat / rejectAllPendingApprovals.js
Created July 8, 2020 09:09
Reject all pending approval requests in Microsoft Automate web interface.
document.querySelectorAll("#content-container > section > landing > div > react-app > div > section > section > section > main > div.ba-DetailsList-container.outerRoot-151 > div.ms-Viewport > div > div > div.ms-DetailsList-contentWrapper.contentWrapper-385 > div > div > div > div > div:nth-child(1) > div > div > div > div > div > div > div:nth-child(2) > div > button > span > i").forEach((e) => {
setTimeout(() => {
e.click()
}, 300);
setTimeout(() => {
document.querySelector("body > div.ms-Layer.ms-Layer--fixed > div > div > div > div.ms-Panel-main > div.ms-Panel-contentInner > div.ms-Panel-footer > div > div > button.ms-Button.ms-Button--primary.ba-Panel-footerButton.ba-Panel-footer-primaryButton > span").click();
}, 2300);
setTimeout(() => {
document.querySelector("body > div:nth-child(33) > div > div > div > div.ms-Panel-main > div.ms-Panel-contentInner > div.ms-Panel-footer > div > div > button").click();
}, 300)