Skip to content

Instantly share code, notes, and snippets.

View angusdev's full-sized avatar

Angus angusdev

View GitHub Profile
@angusdev
angusdev / wiki-tennis.js
Created July 1, 2024 00:47
Make a printable version of tennis draw in Wiki
e=document.querySelector('h3:has(#Top_half)');while(e.previousSibling)e.parentNode.removeChild(e.previousSibling);
e=document.querySelector('#bodyContent');while(e.previousSibling)e.parentNode.removeChild(e.previousSibling);
e=document.querySelector('.mw-page-container');while(e.previousSibling)e.parentNode.removeChild(e.previousSibling);
e=document.querySelector('#mw-content-text');while(e.previousSibling)e.parentNode.removeChild(e.previousSibling);
e=document.querySelector('.mw-content-container');while(e.previousSibling)e.parentNode.removeChild(e.previousSibling);
e=document.querySelector('h2:has(#Seeded_players)').previousSibling;while(e.nextSibling)e.parentNode.removeChild(e.nextSibling);
document.querySelectorAll('.mw-editsection,#catlinks,.mw-footer-container,.vector-settings').forEach(e=>e.parentNode.removeChild(e));
document.querySelectorAll('h4:has(#Section_3),h3:has(#Bottom_half),h4:has(#Section_7)').forEach(e=>e.style.pageBreakBefore='always');
@angusdev
angusdev / tabcount.sql
Last active May 16, 2024 14:23
Select count of all tables
#!/bin/bash
# Check if directory path is provided as an argument
if [ $# -ne 1 ]; then
echo "Usage: $0 <directory_path>"
exit 1
fi
directory="$1"
@angusdev
angusdev / pygrep.py
Last active May 9, 2024 13:17
Python search
import os
import openpyxl
import re
def search_string_in_files(directory, search_string, excel_file):
# Create a new Excel workbook
wb = openpyxl.Workbook()
sheet = wb.active
sheet.title = "Search Results"
sheet['A1'] = "File Name"
@angusdev
angusdev / jobchart.py
Last active May 2, 2024 23:23
jobchart.py
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
import mplcursors
# Sample data
data = {
'Date': ['1-Apr-2024', '1-Apr-2024', '1-Apr-2024', '4-Apr-2024', '5-Apr-2024', '6-Apr-2024'],
'Job': ['FOO', 'FOO', 'FOO', 'FOO', 'FOO', 'FOO'],
'Start': ['1-Apr-2024 13:12:24', '1-Apr-2024 15:23:44', '1-Apr-2024 23:12:52',
@angusdev
angusdev / manhuagui-bookmarklet.js
Created October 1, 2023 20:42
manhuagui.com - view in full screen - use left / right arrow to view prev / next page
javascript:!function(){document.querySelectorAll(".header,.title,.tc,.gg_728,.sub-btn,.backToTop,.backToTop ~ *").forEach((e=>e.parentNode.removeChild(e)));const e=e=>{const t=document.querySelector("#mangaFile");t.style.width&&(t.style.width="",t.style.height=window.innerHeight-20+"px",t.style.marginTop="10px")};e(),new MutationObserver((t=>{t.forEach((t=>{t.addedNodes.length&&new MutationObserver(e).observe(t.addedNodes[0],{attributes:!0,attributeFilter:["style"]})}))})).observe(document.querySelector("#mangaFile").parentNode,{subtree:!0,childList:!0})}();
@angusdev
angusdev / install.sh
Created May 15, 2023 23:11
Sample Rollup Project
npm install --save-dev rollup rollup-plugin-node-resolve rollup-plugin-commonjs rollup-plugin-babel @babel/preset-env
npm run build
@angusdev
angusdev / dropsel.js
Created January 25, 2023 02:09
Select from dropdown
javascript:(function(){window._bak_md=document.onmousedown||function(){};document.onmousedown=function(e){e=e||window.event;t=e.target;if(t.tagName=='SELECT'){p=prompt('Find the text in drop down');if(p){for(i=0;i<t.options.length;i++)if(t.options[i].textContent.indexOf(p)===0){t.selectedIndex=i;break;}}document.onmousedown=window._bak_md;window._bak_md=null;e.preventDefault();e.stopPropagation();}};})();
@angusdev
angusdev / tablefilter.js
Created January 13, 2023 23:53
Add TableFilter
$('<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet">').appendTo(document.head);
$('<link href="https://www.tablefilter.com/tablefilter/style/tablefilter.css" type="text/css" rel="stylesheet">').appendTo(document.head);
var s = document.createElement('script');
s.setAttribute('src', 'https://www.tablefilter.com/tablefilter/tablefilter.js');
s.onload = _ => document.querySelectorAll('table').forEach(e => new TableFilter(e).init());
document.body.appendChild(s);
@angusdev
angusdev / resize.scpt
Created January 6, 2023 14:33
Resize Citrix
tell application "System Events" to tell process "Citrix Viewer"
tell window 2
set position to {100, 100}
set size to {1024, 768}
end tell
end tell
osascript -e 'tell application "System Events" to tell window 2 of process "Citrix Viewer" to set { position, size } to { {100, 65}, {1600, 1200} }'
Function ShellExecuteVB()
Dim objShell
Set objShell = CreateObject("Shell.Application")
Call objShell.ShellExecute("explorer", "c:\your\path\", "c:\your\path\", "", 1)
End Function
ShellExecuteVB()