Skip to content

Instantly share code, notes, and snippets.

View bhagatparwinder's full-sized avatar
♥️
Happy, cheerful & confident!

Parwinder Bhagat bhagatparwinder

♥️
Happy, cheerful & confident!
View GitHub Profile
#!/bin/zsh
# Original by PAUL BOWDEN - Completely remove Microsoft Office
# Change to remove credentials only - keeps Microsoft Office license
echo "Effacement des credentials uniquement"
GetLoggedInUser() {
LOGGEDIN=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/&&!/loginwindow/{print $3}')
if [ "$LOGGEDIN" = "" ]; then
@bhagatparwinder
bhagatparwinder / bootable-windows.md
Created November 23, 2023 18:22
Create bootable Windows USB on Mac
  • Download/Mount the ISO from Microsoft: https://www.microsoft.com/software-download/windows11
  • List your drives: diskutil list
  • Format drive: diskutil eraseDisk MS-DOS WINDOWS GPT /dev/diskX (replace diskX with your disk identifier)
  • Copy all files from ISO excluding install.wim (too big for FAT32)
    • rsync -vha --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/* /Volumes/WINDOWS
  • Install wimlib to split install.wim brew install wimlib
    • wimlib-imagex split /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim /Volumes/WINDOWS/sources/install.swm 3500
    • Split size could be anything under 4GB
  • Profit 🤑
@bhagatparwinder
bhagatparwinder / Mail.plist
Created April 21, 2023 15:34
Turn off link preview in macOS Mail
<!--
Save this plist as /Library/Preferences/FeatureFlags/Domain/Mail.plist and reboot. You can opt for terminal command instead:
sudo defaults write /Library/Preferences/FeatureFlags/Domain/Mail.plist RichLinks -dict-add Enabled -bool NO ;
sudo chmod -R o+rX /Library/Preferences/FeatureFlags
-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
@bhagatparwinder
bhagatparwinder / delete.md
Created June 14, 2022 19:07 — forked from timwco/delete.md
LinkedIn: Delete Messages (June 2022)

What

LinkedIn is a valuable resource, but sometimes it sucks. One of those times is when you want to delete messages. You have to select each message one by one. It takes about 4 "clicks" to successfully delete a message.

This script should help. Since LI requires you to perform multiple steps, I decided to automate it for you. Once you initiate the script, it will run every second. If a message has the ability to be deleted, it will be. If not, it will be archived. Some "InMail" messages cannot be deleted on the web app. This script should work as long as LI doesn't change their page layout or element names, which happens often.

Last tested & verified working on: June, 10, 2022

Special Thanks to @noncent for the updated script.

@bhagatparwinder
bhagatparwinder / validate_credit_card.js
Created May 28, 2021 15:51 — forked from DiegoSalazar/validate_credit_card.js
Luhn algorithm in Javascript. Check valid credit card numbers
// Takes a credit card string value and returns true on valid number
function valid_credit_card(value) {
// Accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
let nCheck = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
@bhagatparwinder
bhagatparwinder / settings.json
Created June 19, 2020 05:41
VS Code Settings
{
"autoimport.doubleQuotes": true,
"breadcrumbs.enabled": true,
"css.lint.important": "warning",
"debug.node.autoAttach": "on",
"debug.toolBarLocation": "docked",
"editor.codeLens": false,
"editor.colorDecorators": true,
"editor.cursorBlinking": "phase",
"editor.cursorStyle": "line",
@bhagatparwinder
bhagatparwinder / extensions
Created June 19, 2020 05:25
VS Code Extensions
code --install-extension Angular.ng-template
code --install-extension CoenraadS.bracket-pair-colorizer
code --install-extension IBM.output-colorizer
code --install-extension Tyriar.sort-lines
code --install-extension WallabyJs.quokka-vscode
code --install-extension adamwalzer.string-converter
code --install-extension alexkrechik.cucumberautocomplete
code --install-extension Arjun.swagger-viewer
code --install-extension atlassian.atlascode
code --install-extension auchenberg.vscode-browser-preview
@bhagatparwinder
bhagatparwinder / npm-upgrade-bleeding.sh
Created January 22, 2020 15:49 — forked from othiym23/npm-upgrade-bleeding.sh
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@bhagatparwinder
bhagatparwinder / aerial.json
Created October 23, 2018 16:11
Apple TV Aerial Screensavers (including ISS International Space Station)
{
"success": 1,
"data": [{
"name": "Southern California to Baja",
"screensavers": [{
"identifier": "7719B48A-2005-4011-9280-2F64EEC6FD91",
"urls": {
"h264": "https://sylvan.apple.com/Videos/comp_A114_C001_0305OT_v10_SDR_FINAL_22062018_SDR_2K_AVC.mov"
},
"timedCaptions": {