├── .gitignore ├── batch ├── turn_hyper-v_off.bat ├── turn_hyper-v_on.bat ├── export_putty_settings_and_sessions.bat ├── add_spacer_to_taskbar │ ├── transparent.ico │ └── add_spacer_to_taskbar.bat ├── switch_to_dark_mode.bat ├── switch_to_light_mode.bat ├── suspend_system.bat ├── export-svg-to-png-for-webextensions.bat ├── remove_old_user_account_pictures.bat ├── find_corrupted_videos.bat ├── convert_microsoft_office_to_pdf.bat ├── remove_adobe_acrobat_browser_extension.bat ├── convert_all_microsoft_office_to_pdf.bat ├── rebuild_icon_cache.bat ├── clear_mpc-hc_favorites.bat ├── manage_pictures.bat └── convert_microsoft_office_to_pdf.vbs ├── bash ├── start_compton.sh ├── keyboard_backlight_brightness_decrease.sh └── keyboard_backlight_brightness_increase.sh ├── registry ├── disable_Bing_searches.reg ├── remove_shortcut_text.reg ├── disable_activity_history.reg ├── restore_3D_Objects_Folder.reg ├── fix_asus_smart_gesture_cpu_usage.reg ├── restore_shortcut_text_to_default.reg ├── turn_start_menu_web_searches_off.reg ├── remove_all_user_folders_from_this_pc.reg ├── restore_all_user_folders_to_this_pc.reg ├── disable_Cortana.reg ├── remove_onedrive_from_file_explorer.reg ├── restore_onedrive_to_file_explorer.reg ├── remove_3D_Objects_Folder.reg ├── add_copy_to_folder_and_move_to_folder_context_menu.reg └── disable_cloud-delivered_protection_and_automatic_sample_submission.reg ├── powershell ├── check_hyper-v_status.ps1 ├── add_content_every_line_start.ps1 ├── get_chkdsk_results.ps1 └── set_windows_defender_cpu_usage_limit.ps1 ├── macros ├── BulletPoint.bas ├── DeleteLine.bas └── SetDefaultRowHeight.bas ├── sql ├── get_size_of_databases.sql └── get_size_of_tables.sql ├── autohotkey ├── mouse_wheel_jumping_test.ahk ├── launch_breevy.ahk ├── keep_window_on_top.ahk ├── lock_computer.ahk ├── display_toast.ahk ├── soundcard_analysis.ahk └── shortcuts_compilation.ahk ├── firefox ├── user.js └── userChrome.css ├── qownnotes ├── Fix_image_rendering_by_using_local_path.qml └── custom-journal-entry.qml ├── wsl ├── merge_mkv_and_srt_in_mkv.sh └── merge_mp4_and_srt_in_mkv.sh ├── dotfiles └── .bash_profile ├── foobar2000 ├── foobar2000_theme.md └── spider_monkey_panel │ ├── playback_buttons.js │ ├── utility_buttons.js │ └── seekbar.js ├── js └── remove_mpc-hc_favorites.js ├── LICENSE ├── README.md └── calibre └── ebook_reader_solarized_dark_theme.css /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.log 3 | *.qmlc -------------------------------------------------------------------------------- /batch/turn_hyper-v_off.bat: -------------------------------------------------------------------------------- 1 | bcdedit /set hypervisorlaunchtype off -------------------------------------------------------------------------------- /batch/turn_hyper-v_on.bat: -------------------------------------------------------------------------------- 1 | bcdedit /set hypervisorlaunchtype auto -------------------------------------------------------------------------------- /bash/start_compton.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | compton --backend glx --paint-on-overlay --glx-no-stencil --vsync opengl-swc -b & 4 | -------------------------------------------------------------------------------- /batch/export_putty_settings_and_sessions.bat: -------------------------------------------------------------------------------- 1 | regedit /e "%USERPROFILE%\Desktop\putty.reg" HKEY_CURRENT_USER\Software\SimonTatham -------------------------------------------------------------------------------- /registry/disable_Bing_searches.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/disable_Bing_searches.reg -------------------------------------------------------------------------------- /registry/remove_shortcut_text.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/remove_shortcut_text.reg -------------------------------------------------------------------------------- /registry/disable_activity_history.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/disable_activity_history.reg -------------------------------------------------------------------------------- /registry/restore_3D_Objects_Folder.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/restore_3D_Objects_Folder.reg -------------------------------------------------------------------------------- /batch/add_spacer_to_taskbar/transparent.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/batch/add_spacer_to_taskbar/transparent.ico -------------------------------------------------------------------------------- /registry/fix_asus_smart_gesture_cpu_usage.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/fix_asus_smart_gesture_cpu_usage.reg -------------------------------------------------------------------------------- /registry/restore_shortcut_text_to_default.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/restore_shortcut_text_to_default.reg -------------------------------------------------------------------------------- /registry/turn_start_menu_web_searches_off.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/turn_start_menu_web_searches_off.reg -------------------------------------------------------------------------------- /registry/remove_all_user_folders_from_this_pc.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/remove_all_user_folders_from_this_pc.reg -------------------------------------------------------------------------------- /registry/restore_all_user_folders_to_this_pc.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddy-gustiaux/scripts/HEAD/registry/restore_all_user_folders_to_this_pc.reg -------------------------------------------------------------------------------- /powershell/check_hyper-v_status.ps1: -------------------------------------------------------------------------------- 1 | if($hyperv.State -eq "Enabled") { 2 | Write-Host "Hyper-V is enabled." 3 | } else { 4 | Write-Host "Hyper-V is disabled." 5 | } -------------------------------------------------------------------------------- /registry/disable_Cortana.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search] 4 | "AllowCortana"=dword:00000000 -------------------------------------------------------------------------------- /macros/BulletPoint.bas: -------------------------------------------------------------------------------- 1 | Attribute VB_Name = "BulletPoint" 2 | Sub BulletPoint() 3 | ' 4 | ' BulletPoint Macro 5 | ' 6 | ' 7 | Selection.Range.ListFormat.ApplyBulletDefault 8 | End Sub 9 | -------------------------------------------------------------------------------- /batch/switch_to_dark_mode.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REG ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize /v AppsUseLightTheme /t REG_DWORD /d 0 /f 4 | ECHO Dark mode activated -------------------------------------------------------------------------------- /batch/switch_to_light_mode.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REG ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize /v AppsUseLightTheme /t REG_DWORD /d 1 /f 4 | ECHO Light mode activated -------------------------------------------------------------------------------- /sql/get_size_of_databases.sql: -------------------------------------------------------------------------------- 1 | SELECT table_schema AS "Database Name", 2 | ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size in (MB)" 3 | FROM information_schema.TABLES 4 | GROUP BY table_schema; -------------------------------------------------------------------------------- /macros/DeleteLine.bas: -------------------------------------------------------------------------------- 1 | Attribute VB_Name = "DeleteLine" 2 | Sub DeleteLine() 3 | ' 4 | ' DeleteLine Macro 5 | ' 6 | ' 7 | Selection.HomeKey Unit:=wdLine 8 | Selection.EndKey Unit:=wdLine, Extend:=wdExtend 9 | Selection.Delete Unit:=wdCharacter, Count:=1 10 | End Sub -------------------------------------------------------------------------------- /sql/get_size_of_tables.sql: -------------------------------------------------------------------------------- 1 | SELECT table_name AS "Table Name", 2 | ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size in (MB)" 3 | FROM information_schema.TABLES 4 | WHERE table_schema = "ENTER_YOUR_DATABASE_NAME_HERE" 5 | ORDER BY (data_length + index_length) DESC; -------------------------------------------------------------------------------- /bash/keyboard_backlight_brightness_decrease.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | brightness_val=$(cat /sys/class/leds/asus::kbd_backlight/brightness) 4 | if [ 0 -lt $brightness_val ] 5 | then 6 | brightness_val=$(($brightness_val - 1)) 7 | echo $brightness_val | tee /sys/class/leds/asus::kbd_backlight/brightness 8 | fi -------------------------------------------------------------------------------- /bash/keyboard_backlight_brightness_increase.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | brightness_val=$(cat /sys/class/leds/asus::kbd_backlight/brightness) 4 | if [ 3 -gt $brightness_val ] 5 | then 6 | brightness_val=$(($brightness_val + 1)) 7 | echo $brightness_val | tee /sys/class/leds/asus::kbd_backlight/brightness 8 | fi -------------------------------------------------------------------------------- /macros/SetDefaultRowHeight.bas: -------------------------------------------------------------------------------- 1 | Attribute VB_Name = "SetDefaultRowHeight" 2 | Sub SetDefaultRowHeight() 3 | 4 | Dim t As Task 5 | 6 | For Each t In ActiveProject.Tasks 7 | If Not t Is Nothing Then 8 | SetRowHeight unit:=1, Rows:=t.UniqueID, useuniqueID:=True 9 | End If 10 | Next t 11 | 12 | End Sub 13 | 14 | -------------------------------------------------------------------------------- /batch/suspend_system.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | SET timeToWait=%1 6 | IF [%timeToWait%] == [] SET timeToWait=20 7 | 8 | ECHO [INFO] This system will be suspended in %timeToWait% seconds 9 | timeout /t %timeToWait% /nobreak 10 | rundll32.exe powrprof.dll,SetSuspendState 0,1,0 -------------------------------------------------------------------------------- /registry/remove_onedrive_from_file_explorer.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] 4 | "System.IsPinnedToNameSpaceTree"=dword:00000000 5 | 6 | [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] 7 | "System.IsPinnedToNameSpaceTree"=dword:00000000 -------------------------------------------------------------------------------- /registry/restore_onedrive_to_file_explorer.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] 4 | "System.IsPinnedToNameSpaceTree"=dword:00000001 5 | 6 | [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] 7 | "System.IsPinnedToNameSpaceTree"=dword:00000001 -------------------------------------------------------------------------------- /powershell/add_content_every_line_start.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string]$file = $(throw "-file is required."), 3 | [string]$text = $(throw "-text is required.") 4 | ) 5 | 6 | $InputFile = Get-Content $file 7 | ForEach($Obj in $InputFile) 8 | { 9 | $start = $text 10 | $combine = $start + $Obj 11 | Add-Content -path "$file-output" -value $combine 12 | } -------------------------------------------------------------------------------- /autohotkey/mouse_wheel_jumping_test.ahk: -------------------------------------------------------------------------------- 1 | ~WheelDown:: 2 | GoingDown := True 3 | if GoingUp 4 | { 5 | MsgBox, , Problem, Mouse wheel is jumping 6 | VarSetCapacity(GoingDown,0) 7 | } 8 | return 9 | 10 | ~WheelUp:: 11 | GoingUp := True 12 | if GoingDown 13 | { 14 | MsgBox, , Problem, Mouse wheel is jumping 15 | VarSetCapacity(GoingUp,0) 16 | } 17 | return -------------------------------------------------------------------------------- /firefox/user.js: -------------------------------------------------------------------------------- 1 | // Disable Pocket 2 | user_pref("extensions.pocket.enabled", false); 3 | // Show IDN Punycode 4 | user_pref("network.IDN_show_punycode", true); 5 | // Display complete URLs 6 | user_pref("browser.urlbar.trimURLs", false); 7 | // Do not send single search term to ISP (requires Firefox 79+) 8 | user_pref("browser.urlbar.dnsResolveSingleWordsAfterSearch", 0); 9 | -------------------------------------------------------------------------------- /powershell/get_chkdsk_results.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Generating logs for chkdsk..." 2 | get-winevent -FilterHashTable @{logname="Application"; id="1001"}| ?{$_.providername -match "wininit"} | fl timecreated, message | out-file "$env:USERPROFILE/Desktop/CHKDSKResults.txt" 3 | Write-Host "Done! Look for CHKDSKResults.txt on the desktop!" 4 | Read-Host -Prompt "Press Enter to exit" 5 | -------------------------------------------------------------------------------- /registry/remove_3D_Objects_Folder.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}] 4 | 5 | 6 | [-HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}] 7 | 8 | -------------------------------------------------------------------------------- /batch/export-svg-to-png-for-webextensions.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | SET svgFile=%1 6 | 7 | FOR %%x in (16 24 32 48 64 96 128 256 512 1024) DO ( 8 | ECHO [WORK] Exporting to "%%xpx" 9 | inkscape --export-png "%svgFile:~0,-4%-%%x.png" -w "%%x" "%svgFile%" 10 | ) 11 | 12 | ECHO [INFO] All operations are completed 13 | ENDLOCAL -------------------------------------------------------------------------------- /autohotkey/launch_breevy.ahk: -------------------------------------------------------------------------------- 1 | #NoTrayIcon 2 | #Persistent 3 | #SingleInstance force 4 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 5 | ; #Warn ; Enable warnings to assist with detecting common errors. 6 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 7 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 8 | 9 | Send !+^{B} -------------------------------------------------------------------------------- /autohotkey/keep_window_on_top.ahk: -------------------------------------------------------------------------------- 1 | #NoTrayIcon 2 | #Persistent 3 | #SingleInstance force 4 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 5 | ; #Warn ; Enable warnings to assist with detecting common errors. 6 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 7 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 8 | 9 | Send !+^{T} -------------------------------------------------------------------------------- /qownnotes/Fix_image_rendering_by_using_local_path.qml: -------------------------------------------------------------------------------- 1 | import QtQml 2.0 2 | 3 | QtObject { 4 | 5 | function noteToMarkdownHtmlHook(note, html) { 6 | var fileName = note.fileName; 7 | var fullNoteFilePath = note.fullNoteFilePath; 8 | var correctLocalPath = fullNoteFilePath.replace(fileName, ''); 9 | html = html.replace(/src="\.\/media/g, 'src="file:///' + correctLocalPath + 'media'); 10 | return html; 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /autohotkey/lock_computer.ahk: -------------------------------------------------------------------------------- 1 | #NoTrayIcon 2 | #Persistent 3 | #SingleInstance force 4 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 5 | ; #Warn ; Enable warnings to assist with detecting common errors. 6 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 7 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 8 | 9 | DllCall("user32.dll\LockWorkStation") -------------------------------------------------------------------------------- /batch/remove_old_user_account_pictures.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | SET /P name="Enter your Windows username: " 6 | ECHO You have entered [%name%] 7 | 8 | SET /P answer="Do you want to continue (Y/n)? " 9 | IF /I {!answer!}=={n} (GOTO :EOF) 10 | IF /I {!answer!}=={no} (GOTO :EOF) 11 | 12 | DEL "C:\Users\%name%\AppData\Roaming\Microsoft\Windows\AccountPictures\*.accountpicture-ms" 13 | 14 | ECHO All old user accounts pictures have been deleted 15 | ENDLOCAL -------------------------------------------------------------------------------- /registry/add_copy_to_folder_and_move_to_folder_context_menu.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Created by: Shawn Brink 4 | ; http://www.tenforums.com 5 | ; Tutorial: http://www.tenforums.com/tutorials/29141-copy-folder-move-folder-context-menu-add-windows-10-a.html 6 | 7 | 8 | ; Copy To folder 9 | [HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\{C2FBB630-2971-11D1-A18C-00C04FD75D13}] 10 | 11 | ; Move To folder 12 | [HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\{C2FBB631-2971-11D1-A18C-00C04FD75D13}] -------------------------------------------------------------------------------- /batch/find_corrupted_videos.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | SET counter=0 6 | 7 | FOR %%x IN (*.mkv,*.mp4) DO ( 8 | ECHO [WORK] Testing "%%x" 9 | ffprobe "%%x" > nul 2>&1 10 | IF errorlevel 1 ( 11 | SET listOfCorruptedFiles[!counter!]="%%x" 12 | SET /A counter=counter+1 13 | ) 14 | ) 15 | 16 | ECHO [INFO] Found %counter% corrupted files 17 | IF !counter! gtr 0 FOR /F "tokens=2 delims==" %%s IN ('SET listOfCorruptedFiles[') DO ECHO [CORRUPTED] %%s 18 | 19 | ECHO [INFO] All operations are completed 20 | ENDLOCAL -------------------------------------------------------------------------------- /wsl/merge_mkv_and_srt_in_mkv.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | declare -a args 4 | 5 | for mkv in *.mkv ; do 6 | base="${mkv%mkv}" 7 | output="${base// /_}" 8 | args=(-o "output/${output}mkv" "${mkv}") 9 | 10 | if [[ -f "${base}srt" ]]; then 11 | args=("${args[@]}" --language 0:eng --track-name 0:English "${base}srt") 12 | 13 | echo "[INFO] Processing [$mkv]" 14 | 15 | mkvmerge.exe "${args[@]}" 16 | 17 | echo "[INFO] Completed [$mkv]" 18 | else 19 | echo "[INFO] Skipping [$mkv] (reason: no subtitles found)" 20 | fi 21 | 22 | done 23 | -------------------------------------------------------------------------------- /registry/disable_cloud-delivered_protection_and_automatic_sample_submission.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; This will disable the Cloud-Delivered Protection and Automatic Sample Submission of Windows Defender. 4 | ; It simulates the usage of local GPO to avoid having to dismiss Windows Defender warnings after each reboot. 5 | ; Information found here: https://windowsreport.com/disable-windows-defender-cloud-based-automatic-sample-submission/ 6 | 7 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet] 8 | "SubmitSamplesConsent"=dword:00000002 9 | "SpynetReporting"=dword:00000000 10 | -------------------------------------------------------------------------------- /wsl/merge_mp4_and_srt_in_mkv.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | declare -a args 4 | 5 | for directory in */ ; do 6 | echo "[INFO] Going into [$directory]" 7 | cd "$directory" || exit 1 8 | 9 | for mp4 in *.mp4 ; do 10 | base="${mp4%mp4}" 11 | output="${base// /_}" 12 | args=(-o "output/${output}mkv" "${mp4}") 13 | 14 | if [[ -f "${base}srt" ]]; then 15 | args=("${args[@]}" "${base}srt") 16 | fi 17 | 18 | echo "[INFO] Processing [$mp4]" 19 | 20 | mkvmerge.exe "${args[@]}" 21 | 22 | echo "[INFO] Completed [$mp4]" 23 | done 24 | cd .. 25 | done 26 | -------------------------------------------------------------------------------- /batch/convert_microsoft_office_to_pdf.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | REM Check that the script can run 6 | SET scriptDirectory=%~dp0 7 | SET script=%scriptDirectory%%~n0 8 | IF NOT EXIST "%script%.vbs" ( 9 | ECHO [ERROR] VBScript for conversion not found 10 | GOTO :EOF 11 | ) ELSE ( 12 | SET vbs="%script%.vbs" 13 | ) 14 | 15 | IF "%1" == "" ( 16 | ECHO [ERROR] No file provided 17 | GOTO :EOF 18 | ) ELSE ( 19 | SET name=%1 20 | ) 21 | 22 | ECHO [WORK] Converting "%name%" 23 | cscript //B "%vbs%" "%name%" 24 | 25 | ECHO [INFO] All operations are completed 26 | 27 | :EOF 28 | ENDLOCAL -------------------------------------------------------------------------------- /autohotkey/display_toast.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | ; #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | 6 | TrayTip %1%, %2%, 3, 1 7 | Sleep 3000 ; Let it display for 3 seconds. 8 | HideTrayTip() 9 | 10 | HideTrayTip() { 11 | if SubStr(A_OSVersion,1,3) = "10." { 12 | Menu Tray, NoIcon 13 | Sleep 200 ; It may be necessary to adjust this sleep. 14 | Menu Tray, Icon 15 | } else { 16 | TrayTip 17 | } 18 | } -------------------------------------------------------------------------------- /firefox/userChrome.css: -------------------------------------------------------------------------------- 1 | /* See https://www.userchrome.org/what-is-userchrome-css.html#colorbookmarkfolder */ 2 | 3 | #bookmarks-view treechildren::-moz-tree-image(container), 4 | #PlacesToolbarItems toolbarbutton[container="true"][label="Inbox"] .toolbarbutton-icon, 5 | #PlacesToolbarItems menu[container="true"][label="Inbox"] > .menu-iconic-left > .menu-iconic-icon, 6 | #PlacesChevronPopup menu[container="true"][label="Inbox"] > .menu-iconic-left > .menu-iconic-icon, 7 | #BMB_bookmarksPopup menu[container="true"][label="Inbox"] > .menu-iconic-left > .menu-iconic-icon, 8 | #bookmarksMenu menu[container="true"][label="Inbox"] > .menu-iconic-left > .menu-iconic-icon { 9 | fill: #FF8A80 !important; 10 | } -------------------------------------------------------------------------------- /dotfiles/.bash_profile: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # ENVIRONMENT VARIABLES 3 | # ============================================================================= 4 | 5 | export PATH_TO_PEM_KEY="/path/to/key.pem"; 6 | export SSH_LOGIN="username"; 7 | 8 | # ============================================================================= 9 | # FUNCTIONS 10 | # ============================================================================= 11 | 12 | mcd() { 13 | mkdir -p -- "$1" && cd -P -- "$1"; 14 | } 15 | 16 | __ssh() { 17 | ssh -i $PATH_TO_PEM_KEY -l $SSH_LOGIN $@; 18 | } 19 | 20 | @ssh_via_bastion() { 21 | ssh -i $PATH_TO_PEM_KEY "$1"@"$2" -o "proxycommand ssh -W %h:%p -i $PATH_TO_PEM_KEY ec2-user@bastion.xyz"; 22 | } 23 | -------------------------------------------------------------------------------- /powershell/set_windows_defender_cpu_usage_limit.ps1: -------------------------------------------------------------------------------- 1 | # Usage: set_windows_defender_cpu_usage.ps1 NUMBER 2 | # NUMBER must between 0 (unlimited) and 100 3 | # See https://docs.microsoft.com/en-us/powershell/module/defender/set-mppreference 4 | 5 | if (([string]::IsNullOrEmpty($args[0]))) { 6 | Write-Host "[ERROR] Missing parameter. You must provide a first parameter as an integer between 0 and 100." 7 | } 8 | else { 9 | [int]$cpu = $args[0]; 10 | if ($cpu -lt 0 -Or $cpu -gt 100) { 11 | Write-Host "[ERROR] Incorrect parameter. You must provide a first parameter as an integer between 0 and 100." 12 | } 13 | else { 14 | Write-Host "[INFO] Setting Windows Defender CPU usage limit to $cpu%." 15 | Set-MpPreference -ScanAvgCPULoadFactor $cpu 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /batch/remove_adobe_acrobat_browser_extension.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | REM Get script directory 6 | SET startDirectory=%~dp0 7 | REM Adobe Acrobat browser extension directory 8 | SET extensionDirectory="C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Browser" 9 | 10 | REM Ask user confirmation 11 | ECHO This will delete all the content in %extensionDirectory%. 12 | SET /P answer="Do you want to continue (Y/n)? " 13 | IF /i {!answer!}=={n} (GOTO :END) 14 | IF /i {!answer!}=={no} (GOTO :END) 15 | 16 | :PROCESS 17 | 18 | ECHO ^=^=^> Moving to Adobe Acrobat browser extension directory 19 | cd /d %extensionDirectory% 20 | 21 | ECHO ^=^=^> Deleting all files and folders 22 | FOR /F "delims=" %%i IN ('dir /b') DO ( 23 | rmdir "%%i" /S || del "%%i" /S /F 24 | ) 25 | 26 | ECHO ^=^=^> Done^^! 27 | 28 | :END 29 | cd %startDirectory% 30 | ENDLOCAL 31 | -------------------------------------------------------------------------------- /foobar2000/foobar2000_theme.md: -------------------------------------------------------------------------------- 1 | # Foobar2000 Theme 2 | 3 | ## Colors 4 | 5 | **Foreground color:** 6 | 7 | - #dbdbdb 8 | - rgb(219,219,219) 9 | 10 | **Bakground color of non-selected items:** 11 | 12 | - #141414 13 | - rgb(20,20,20) 14 | 15 | **Bakground color of selected items:** 16 | 17 | - #dc2328 18 | rgb(220,35,40) 19 | 20 | **Bakground color of selected but inactive items:** 21 | 22 | - #8c161a 23 | - rgb(140,22,26) 24 | 25 | ## OSD 26 | 27 | ``` 28 | // For line breaks, use $char(10) 29 | // Color for the first text information (paused or track title) 30 | $rgb(220,35,40,0,0,0) 31 | // Indicates if the track is paused or not 32 | $if(%_ispaused%,'[paused]'$char(10)) 33 | // Display title 34 | $pad_right(%title%,80) 35 | // Display album artist if set 36 | [$char(10)%album artist%] 37 | // Display album name if set 38 | [$char(10)%album%] 39 | // Display date if set 40 | [$char(10)%date%] 41 | ``` -------------------------------------------------------------------------------- /js/remove_mpc-hc_favorites.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const fs = require('fs') 4 | const readline = require('readline') 5 | 6 | let section = 'Favorites\\Files' 7 | 8 | const lineReader = readline.createInterface({ 9 | input: fs.createReadStream(process.argv[2]), 10 | output: fs.createWriteStream(process.argv[3]), 11 | }); 12 | 13 | let start = false 14 | 15 | lineReader.on('line', function (line) { 16 | if (line === '[Favorites\\Files]') { 17 | start = true 18 | this.output.write(`${line}\n`) 19 | } 20 | if (start === true) { 21 | if (line === '[FileFormats]') { 22 | start = false 23 | this.output.write(`${line}\n`) 24 | } 25 | } else { 26 | this.output.write(`${line}\n`) 27 | } 28 | }); 29 | 30 | fs.unlinkSync(process.argv[2]) 31 | setTimeout(() => { 32 | fs.renameSync(process.argv[3], process.argv[2]) 33 | }, 100) -------------------------------------------------------------------------------- /batch/convert_all_microsoft_office_to_pdf.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | REM Check that the script can run 6 | SET scriptDirectory=%~dp0 7 | SET script="%scriptDirectory%convert_microsoft_office_to_pdf" 8 | IF NOT EXIST "%script%.vbs" ( 9 | ECHO [ERROR] VBScript for conversion not found 10 | GOTO :EOF 11 | ) ELSE ( 12 | SET vbs="%script%.vbs" 13 | ) 14 | 15 | REM Get number of documents 16 | SET count=0 17 | FOR %%x in (*.doc,*.docx,*.ppt,*.pptx) DO SET /a count+=1 18 | 19 | IF %count% EQU 0 ( 20 | ECHO [ERROR] No documents found in current folder 21 | GOTO :EOF 22 | ) 23 | 24 | SET number=1 25 | FOR %%f IN (*.doc,*.docx,*.ppt,*.pptx) DO ( 26 | ECHO [WORK] Converting "%%f" (!number!/%count%^) 27 | cscript //B "%vbs%" "%%~dpnxf" 28 | SET /a number+=1 29 | ) 30 | 31 | ECHO [INFO] All operations are completed 32 | 33 | :EOF 34 | ENDLOCAL -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Teddy Gustiaux 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /batch/rebuild_icon_cache.bat: -------------------------------------------------------------------------------- 1 | :: Created by: Shawn Brink 2 | :: Created on: April 27th 2015 3 | :: Tutorial: http://www.tenforums.com/tutorials/5645-icon-cache-rebuild-windows-10-a.html 4 | 5 | 6 | @echo off 7 | set iconcache=%localappdata%\IconCache.db 8 | 9 | echo. 10 | echo The explorer process must be temporarily killed before deleting the IconCache.db file. 11 | echo. 12 | echo Please SAVE ALL OPEN WORK before continuing. 13 | echo. 14 | pause 15 | echo. 16 | If exist "%iconcache%" goto delete 17 | echo. 18 | echo The IconCache.db file has already been deleted. 19 | goto restart 20 | 21 | 22 | :delete 23 | echo. 24 | echo Attempting to delete IconCache.db files... 25 | echo. 26 | ie4uinit.exe -show 27 | taskkill /IM explorer.exe /F 28 | del /A /Q "%iconcache%" 29 | del /A /F /Q "%localappdata%\Microsoft\Windows\Explorer\iconcache*" 30 | start explorer.exe 31 | echo. 32 | echo IconCache.db files have been successfully deleted. 33 | goto restart 34 | 35 | 36 | :restart 37 | echo. 38 | echo. 39 | echo You will need to restart the PC to finish rebuilding your icon cache. 40 | echo. 41 | CHOICE /C:YN /M "Do you want to restart the PC now?" 42 | IF ERRORLEVEL 2 goto no 43 | IF ERRORLEVEL 1 goto yes 44 | 45 | :yes 46 | shutdown /r /f /t 00 47 | 48 | :no 49 | exit /B -------------------------------------------------------------------------------- /batch/add_spacer_to_taskbar/add_spacer_to_taskbar.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL ENABLEDELAYEDEXPANSION 3 | 4 | REM Get script directory 5 | SET startDirectory=%~dp0 6 | 7 | REM Generate datetime to avoid shortcut duplication error 8 | set hour=%time:~0,2% 9 | if "%hour:~0,1%" == " " set hour=0%hour:~1,1% 10 | set min=%time:~3,2% 11 | if "%min:~0,1%" == " " set min=0%min:~1,1% 12 | set secs=%time:~6,2% 13 | if "%secs:~0,1%" == " " set secs=0%secs:~1,1% 14 | set year=%date:~0,4% 15 | set month=%date:~5,2% 16 | set day=%date:~8,2% 17 | set datetime=%year%%month%%day%%hour%%min%%secs% 18 | 19 | REM Shortcut name 20 | SET LinkName=Spacer_%datetime% 21 | REM Shortcut icon 22 | SET LinkIcon=%startDirectory%transparent.ico 23 | REM Create the shortcut on the Desktop 24 | SET Esc_LinkDest=%%HOMEDRIVE%%%%HOMEPATH%%\Desktop\!LinkName!.lnk 25 | REM Point to an executable that will perform nothing without parameters 26 | SET Esc_LinkTarget=%%SYSTEMROOT%%\System32\rundll32.exe 27 | 28 | REM File for the VB script 29 | SET cSctVBS=CreateShortcut.vbs 30 | REM File for the VB script logs 31 | SET LOG=".\%~N0_runtime.log" 32 | 33 | REM Generate the VB code to create the shortcut 34 | REM See https://ss64.com/vb/shortcut.html 35 | (( 36 | echo Set oWS = WScript.CreateObject^("WScript.Shell"^) 37 | echo sLinkFile = oWS.ExpandEnvironmentStrings^("!Esc_LinkDest!"^) 38 | echo Set oLink = oWS.CreateShortcut^(sLinkFile^) 39 | echo oLink.TargetPath = oWS.ExpandEnvironmentStrings^("!Esc_LinkTarget!"^) 40 | echo oLink.Arguments = "!LinkName!" 41 | echo oLink.IconLocation = "!LinkIcon!" 42 | echo oLink.Save 43 | )1>!cSctVBS! 44 | 45 | REM Execute the VB script 46 | cscript //nologo .\!cSctVBS! 47 | REM Delete the VB script 48 | DEL !cSctVBS! /f /q 49 | REM Log everything 50 | )1>>!LOG! 2>>&1 51 | 52 | ECHO The shortcut was created on the Desktop 53 | ECHO Next steps: 54 | ECHO - Pin the shortcut to the taskbar 55 | ECHO - Delete the shortcut 56 | -------------------------------------------------------------------------------- /batch/clear_mpc-hc_favorites.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | CLS 3 | ECHO. 4 | ECHO ============================= 5 | ECHO Running Admin shell 6 | ECHO ============================= 7 | 8 | :init 9 | setlocal DisableDelayedExpansion 10 | set cmdInvoke=1 11 | set winSysFolder=System32 12 | set "batchPath=%~0" 13 | for %%k in (%0) do set batchName=%%~nk 14 | set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" 15 | setlocal EnableDelayedExpansion 16 | 17 | :checkPrivileges 18 | NET FILE 1>NUL 2>NUL 19 | if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) 20 | 21 | :getPrivileges 22 | if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) 23 | ECHO. 24 | ECHO ************************************** 25 | ECHO Invoking UAC for Privilege Escalation 26 | ECHO ************************************** 27 | 28 | ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%" 29 | ECHO args = "ELEV " >> "%vbsGetPrivileges%" 30 | ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" 31 | ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" 32 | ECHO Next >> "%vbsGetPrivileges%" 33 | 34 | if '%cmdInvoke%'=='1' goto InvokeCmd 35 | 36 | ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" 37 | goto ExecElevation 38 | 39 | :InvokeCmd 40 | ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%" 41 | ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%" 42 | 43 | :ExecElevation 44 | "%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %* 45 | exit /B 46 | 47 | :gotPrivileges 48 | setlocal & cd /d %~dp0 49 | if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) 50 | 51 | :::::::::::::::::::::::::::: 52 | ::START 53 | :::::::::::::::::::::::::::: 54 | 55 | SET startDirectory=%~dp0 56 | SET iniFile="C:\Program Files\MPC-HC\mpc-hc64.ini" 57 | SET iniFileModified="C:\Program Files\MPC-HC\mpc-hc64.ini.modified" 58 | 59 | IF EXIST %iniFile% ( 60 | REM If favorites are stored in the INI file 61 | node "%startDirectory%..\js\remove_mpc-hc_favorites.js" %iniFile% %iniFileModified% 62 | ) ELSE ( 63 | REM If favorites are stored in the Registry 64 | REG DELETE "HKEY_CURRENT_USER\Software\MPC-HC\MPC-HC\Favorites\Files" /va /f 65 | ) 66 | 67 | ECHO MPC-HC favorites deleted successfully -------------------------------------------------------------------------------- /foobar2000/spider_monkey_panel/playback_buttons.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | window.DefinePanel('Playback Buttons', { 4 | author: "Teddy Gustiaux, adapted from marc2k3's script", 5 | version: '2019.01.06', 6 | }); 7 | // Based on the script found at https://github.com/marc2k3/smp_2003/blob/master/track%20info%20%2B%20seekbar%20%2B%20buttons.txt 8 | 9 | include(fb.ComponentPath + 'samples\\complete\\js\\lodash.min.js'); 10 | include(fb.ComponentPath + 'samples\\complete\\js\\helpers.js'); 11 | include(fb.ComponentPath + 'samples\\complete\\js\\panel.js'); 12 | include(fb.ComponentPath + 'samples\\complete\\js\\seekbar.js'); 13 | 14 | // For more documentation, refer to 15 | // https://github.com/marc2k3/smp_2003/blob/master/js/helpers.js 16 | // https://github.com/TheQwertiest/foo_spider_monkey_panel/blob/master/component/docs/Flags.js 17 | // %AppData%\foobar2000\user-components\foo_spider_monkey_panel\docs\html 18 | 19 | ////////////////////////////////////////////////////////////// 20 | 21 | let colours = { 22 | buttons: window.GetColourCUI(0), 23 | background : window.GetColourCUI(3), 24 | }; 25 | 26 | function _unicodeToImg(chr, colour) { 27 | const size = 256; 28 | let temp_bmp = gdi.CreateImage(size, size); 29 | let temp_gr = temp_bmp.GetGraphics(); 30 | temp_gr.SetTextRenderingHint(4); 31 | let fontItemsEnlarged = gdi.Font(window.GetFontCUI(0).Name, window.GetFontCUI(0).Size * 15, 1); 32 | temp_gr.DrawString(chr, fontItemsEnlarged, colour, 0, 0, size, size, SF_CENTRE); 33 | temp_bmp.ReleaseGraphics(temp_gr); 34 | temp_gr = null; 35 | return temp_bmp; 36 | } 37 | 38 | ////////////////////////////////////////////////////////////// 39 | 40 | let panel = new _panel(); 41 | let buttons = new _buttons(); 42 | const bs = _scale(24); 43 | on_playback_new_track(fb.GetNowPlaying()); 44 | 45 | buttons.update = () => { 46 | const y = Math.round((panel.h - bs) / 2); 47 | buttons.buttons.stop = new _button(LM + (bs * 0), y, bs, bs, {normal : _unicodeToImg('\u25fc', colours.buttons)}, () => { fb.Stop(); }, 'Stop'); 48 | buttons.buttons.previous = new _button(LM + (bs * 1), y, bs, bs, {normal : _unicodeToImg('\u23EE', colours.buttons)}, () => { fb.Prev(); }, 'Previous'); 49 | buttons.buttons.play = new _button(LM + (bs * 2), y, bs, bs, {normal : !fb.IsPlaying || fb.IsPaused ? _unicodeToImg('\u2bc8', colours.buttons) : _unicodeToImg('\u23F8', colours.buttons)}, () => { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause'); 50 | buttons.buttons.next = new _button(LM + (bs * 3), y, bs, bs, {normal : _unicodeToImg('\u23ED', colours.buttons)}, () => { fb.Next(); }, 'Next'); 51 | } 52 | 53 | function on_mouse_lbtn_down(x, y) { 54 | return; 55 | } 56 | 57 | function on_mouse_lbtn_up(x, y) { 58 | if (buttons.lbtn_up(x, y)) { 59 | return; 60 | } 61 | } 62 | 63 | function on_mouse_leave() { 64 | buttons.leave(); 65 | } 66 | 67 | function on_mouse_move(x, y) { 68 | if (buttons.move(x, y)) { 69 | return; 70 | } 71 | } 72 | 73 | function on_mouse_rbtn_up(x, y) { 74 | return panel.rbtn_up(x, y); 75 | } 76 | 77 | function on_paint(gr) { 78 | gr.FillSolidRect(0, 0, panel.w, panel.h, colours.background); 79 | buttons.paint(gr); 80 | } 81 | 82 | function on_playback_edited() { 83 | window.Repaint(); 84 | } 85 | 86 | function on_playback_new_track(metadb) { 87 | if (!metadb) { 88 | return; 89 | } 90 | window.Repaint(); 91 | } 92 | 93 | function on_playback_pause() { 94 | buttons.update(); 95 | window.Repaint(); 96 | } 97 | 98 | function on_playback_starting() { 99 | buttons.update(); 100 | window.Repaint(); 101 | } 102 | 103 | function on_playback_stop() { 104 | buttons.update(); 105 | window.Repaint(); 106 | } 107 | 108 | function on_size() { 109 | panel.size(); 110 | buttons.update(); 111 | } 112 | -------------------------------------------------------------------------------- /foobar2000/spider_monkey_panel/utility_buttons.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | window.DefinePanel('Playback Buttons', { 4 | author: "Teddy Gustiaux, adapted from marc2k3's script", 5 | version: '2019.01.06', 6 | }); 7 | // Based on the script found at https://github.com/marc2k3/smp_2003/blob/master/track%20info%20%2B%20seekbar%20%2B%20buttons.txt 8 | 9 | include(fb.ComponentPath + 'samples\\complete\\js\\lodash.min.js'); 10 | include(fb.ComponentPath + 'samples\\complete\\js\\helpers.js'); 11 | include(fb.ComponentPath + 'samples\\complete\\js\\panel.js'); 12 | include(fb.ComponentPath + 'samples\\complete\\js\\seekbar.js'); 13 | 14 | // For more documentation, refer to 15 | // https://github.com/marc2k3/smp_2003/blob/master/js/helpers.js 16 | // https://github.com/TheQwertiest/foo_spider_monkey_panel/blob/master/component/docs/Flags.js 17 | // %AppData%\foobar2000\user-components\foo_spider_monkey_panel\docs\html 18 | 19 | ////////////////////////////////////////////////////////////// 20 | 21 | let colours = { 22 | buttons: window.GetColourCUI(0), 23 | background : window.GetColourCUI(3), 24 | }; 25 | 26 | function _unicodeToImg(chr, colour) { 27 | const size = 256; 28 | let temp_bmp = gdi.CreateImage(size, size); 29 | let temp_gr = temp_bmp.GetGraphics(); 30 | temp_gr.SetTextRenderingHint(4); 31 | let fontItemsEnlarged = gdi.Font(window.GetFontCUI(0).Name, window.GetFontCUI(0).Size * 15, 1); 32 | temp_gr.DrawString(chr, fontItemsEnlarged, colour, 0, 0, size, size, SF_CENTRE); 33 | temp_bmp.ReleaseGraphics(temp_gr); 34 | temp_gr = null; 35 | return temp_bmp; 36 | } 37 | 38 | ////////////////////////////////////////////////////////////// 39 | 40 | let panel = new _panel(); 41 | let buttons = new _buttons(); 42 | const bs = _scale(24); 43 | on_playback_new_track(fb.GetNowPlaying()); 44 | 45 | buttons.update = () => { 46 | const y = Math.round((panel.h - bs) / 2); 47 | buttons.buttons.stop = new _button(LM + (bs * 0), y, bs, bs, {normal : _unicodeToImg('\u25fc', colours.buttons)}, () => { fb.Stop(); }, 'Stop'); 48 | buttons.buttons.previous = new _button(LM + (bs * 1), y, bs, bs, {normal : _unicodeToImg('\u23EE', colours.buttons)}, () => { fb.Prev(); }, 'Previous'); 49 | buttons.buttons.play = new _button(LM + (bs * 2), y, bs, bs, {normal : !fb.IsPlaying || fb.IsPaused ? _unicodeToImg('\u2bc8', colours.buttons) : _unicodeToImg('\u23F8', colours.buttons)}, () => { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause'); 50 | buttons.buttons.next = new _button(LM + (bs * 3), y, bs, bs, {normal : _unicodeToImg('\u23ED', colours.buttons)}, () => { fb.Next(); }, 'Next'); 51 | } 52 | 53 | function on_mouse_lbtn_down(x, y) { 54 | return; 55 | } 56 | 57 | function on_mouse_lbtn_up(x, y) { 58 | if (buttons.lbtn_up(x, y)) { 59 | return; 60 | } 61 | } 62 | 63 | function on_mouse_leave() { 64 | buttons.leave(); 65 | } 66 | 67 | function on_mouse_move(x, y) { 68 | if (buttons.move(x, y)) { 69 | return; 70 | } 71 | } 72 | 73 | function on_mouse_rbtn_up(x, y) { 74 | return panel.rbtn_up(x, y); 75 | } 76 | 77 | function on_paint(gr) { 78 | gr.FillSolidRect(0, 0, panel.w, panel.h, colours.background); 79 | buttons.paint(gr); 80 | } 81 | 82 | function on_playback_edited() { 83 | window.Repaint(); 84 | } 85 | 86 | function on_playback_new_track(metadb) { 87 | if (!metadb) { 88 | return; 89 | } 90 | window.Repaint(); 91 | } 92 | 93 | function on_playback_pause() { 94 | buttons.update(); 95 | window.Repaint(); 96 | } 97 | 98 | function on_playback_starting() { 99 | buttons.update(); 100 | window.Repaint(); 101 | } 102 | 103 | function on_playback_stop() { 104 | buttons.update(); 105 | window.Repaint(); 106 | } 107 | 108 | function on_size() { 109 | panel.size(); 110 | buttons.update(); 111 | } 112 | -------------------------------------------------------------------------------- /autohotkey/soundcard_analysis.ahk: -------------------------------------------------------------------------------- 1 | ; Taken from https://www.autohotkey.com/docs/commands/SoundSet.htm 2 | 3 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 4 | ; #Warn ; Enable warnings to assist with detecting common errors. 5 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 6 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 7 | 8 | SetBatchLines -1 9 | SplashTextOn,,, Gathering Soundcard Info... 10 | 11 | ; Most of the pure numbers below probably don't exist in any mixer, but they're queried for completeness. 12 | ; The numbers correspond to the following items (in order): CUSTOM, BOOLEANMETER, SIGNEDMETER, PEAKMETER, 13 | ; UNSIGNEDMETER, BOOLEAN, BUTTON, DECIBELS, SIGNED, UNSIGNED, PERCENT, SLIDER, FADER, SINGLESELECT, MUX, 14 | ; MULTIPLESELECT, MIXER, MICROTIME, MILLITIME 15 | ControlTypes = VOLUME,ONOFF,MUTE,MONO,LOUDNESS,STEREOENH,BASSBOOST,PAN,QSOUNDPAN,BASS,TREBLE,EQUALIZER,0x00000000, 0x10010000,0x10020000,0x10020001,0x10030000,0x20010000,0x21010000,0x30040000,0x30020000,0x30030000,0x30050000,0x40020000,0x50030000,0x70010000,0x70010001,0x71010000,0x71010001,0x60030000,0x61030000 16 | 17 | ComponentTypes = MASTER,HEADPHONES,DIGITAL,LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,WAVE,AUX,ANALOG,N/A 18 | 19 | ; Create a ListView and prepare for the main loop: 20 | Gui, Add, Listview, w400 h400 vMyListView, Component Type|Control Type|Setting|Mixer 21 | LV_ModifyCol(4, "Integer") 22 | SetFormat, Float, 0.2 ; Limit number of decimal places in percentages to two. 23 | 24 | Loop ; For each mixer number that exists in the system, query its capabilities. 25 | { 26 | CurrMixer := A_Index 27 | SoundGet, Setting,,, %CurrMixer% 28 | if ErrorLevel = Can't Open Specified Mixer ; Any error other than this indicates that the mixer exists. 29 | break 30 | 31 | ; For each component type that exists in this mixer, query its instances and control types: 32 | Loop, parse, ComponentTypes, `, 33 | { 34 | CurrComponent := A_LoopField 35 | ; First check if this component type even exists in the mixer: 36 | SoundGet, Setting, %CurrComponent%,, %CurrMixer% 37 | if ErrorLevel = Mixer Doesn't Support This Component Type 38 | continue ; Start a new iteration to move on to the next component type. 39 | Loop ; For each instance of this component type, query its control types. 40 | { 41 | CurrInstance := A_Index 42 | ; First check if this instance of this instance even exists in the mixer: 43 | SoundGet, Setting, %CurrComponent%:%CurrInstance%,, %CurrMixer% 44 | ; Checking for both of the following errors allows this script to run on older versions: 45 | if ErrorLevel in Mixer Doesn't Have That Many of That Component Type,Invalid Control Type or Component Type 46 | break ; No more instances of this component type. 47 | ; Get the current setting of each control type that exists in this instance of this component: 48 | Loop, parse, ControlTypes, `, 49 | { 50 | CurrControl := A_LoopField 51 | SoundGet, Setting, %CurrComponent%:%CurrInstance%, %CurrControl%, %CurrMixer% 52 | ; Checking for both of the following errors allows this script to run on older versions: 53 | if ErrorLevel in Component Doesn't Support This Control Type,Invalid Control Type or Component Type 54 | continue 55 | if ErrorLevel ; Some other error, which is unexpected so show it in the results. 56 | Setting := ErrorLevel 57 | ComponentString := CurrComponent 58 | if CurrInstance > 1 59 | ComponentString = %ComponentString%:%CurrInstance% 60 | LV_Add("", ComponentString, CurrControl, Setting, CurrMixer) 61 | } ; For each control type. 62 | } ; For each component instance. 63 | } ; For each component type. 64 | } ; For each mixer. 65 | 66 | Loop % LV_GetCount("Col") ; Auto-size each column to fit its contents. 67 | LV_ModifyCol(A_Index, "AutoHdr") 68 | 69 | SplashTextOff 70 | Gui, Show 71 | return 72 | 73 | GuiClose: 74 | ExitApp 75 | -------------------------------------------------------------------------------- /foobar2000/spider_monkey_panel/seekbar.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Seekbar component using the defined user theme 4 | // Other features: 5 | // - Click outside of the seebar to trigger "View/Show now playing in playlist' 6 | // - Use the mouse wheel outside of the seebar to change the volume 7 | 8 | window.DefinePanel('Seekbar', { 9 | author: "Teddy Gustiaux, adapted from marc2k3's script", 10 | version: '2019.01.06', 11 | }); 12 | // Based on the script found at https://github.com/marc2k3/smp_2003/blob/master/track%20info%20%2B%20seekbar%20%2B%20buttons.txt 13 | 14 | include(fb.ComponentPath + 'samples\\complete\\js\\lodash.min.js'); 15 | include(fb.ComponentPath + 'samples\\complete\\js\\helpers.js'); 16 | include(fb.ComponentPath + 'samples\\complete\\js\\panel.js'); 17 | include(fb.ComponentPath + 'samples\\complete\\js\\seekbar.js'); 18 | 19 | // For more documentation, refer to 20 | // https://github.com/marc2k3/smp_2003/blob/master/js/helpers.js 21 | // https://github.com/TheQwertiest/foo_spider_monkey_panel/blob/master/component/docs/Flags.js 22 | // %AppData%\foobar2000\user-components\foo_spider_monkey_panel\docs\html 23 | 24 | ////////////////////////////////////////////////////////////// 25 | 26 | let colours = { 27 | background : window.GetColourCUI(3), 28 | time : window.GetColourCUI(0), 29 | seekbar_background: _blendColours(window.GetColourCUI(3), window.GetColourCUI(0), 0.5), 30 | seekbar_progress : window.GetColourCUI(5), 31 | seekbar_knob : window.GetColourCUI(4), 32 | }; 33 | 34 | let font = { 35 | items: window.GetFontCUI(0), 36 | itemsEmphasized: gdi.Font(window.GetFontCUI(0).Name, window.GetFontCUI(0).Size + 2, 1), 37 | labels: window.GetFontCUI(1), 38 | } 39 | 40 | let tfo = { 41 | playback_time : fb.TitleFormat('%playback_time% '), 42 | length : fb.TitleFormat(' %length% / -%playback_time_remaining%') 43 | }; 44 | 45 | ////////////////////////////////////////////////////////////// 46 | 47 | let panel = new _panel(); 48 | let seekbar = new _seekbar(0, 0, 0, 0); 49 | const bs = _scale(24); 50 | on_playback_new_track(fb.GetNowPlaying()); 51 | 52 | function on_mouse_lbtn_down(x, y) { 53 | seekbar.lbtn_down(x, y); 54 | } 55 | 56 | function on_mouse_lbtn_up(x, y) { 57 | if (seekbar.lbtn_up(x, y)) { 58 | return; 59 | } 60 | fb.RunMainMenuCommand('View/Show now playing in playlist'); 61 | } 62 | 63 | function on_mouse_leave() { 64 | return; 65 | } 66 | 67 | function on_mouse_move(x, y) { 68 | seekbar.move(x, y); 69 | } 70 | 71 | function on_mouse_rbtn_up(x, y) { 72 | return panel.rbtn_up(x, y); 73 | } 74 | 75 | function on_mouse_wheel(s) { 76 | if (seekbar.wheel(s)) { 77 | return; 78 | } 79 | if (s == 1) { 80 | fb.VolumeUp(); 81 | } else { 82 | fb.VolumeDown(); 83 | } 84 | } 85 | 86 | function on_paint(gr) { 87 | // Draw the background of the panel 88 | gr.FillSolidRect(0, 0, panel.w, panel.h, colours.background); 89 | // Fill the "unplayed" portion of the seekbar 90 | gr.FillSolidRect(seekbar.x, seekbar.y, seekbar.w + _scale(6), seekbar.h, colours.seekbar_background); 91 | if (fb.IsPlaying) { 92 | gr.SetSmoothingMode(2); 93 | if (fb.PlaybackLength > 0) { 94 | const pos = seekbar.pos(); 95 | // Fill the "played" portion of the seekbar 96 | gr.FillSolidRect(seekbar.x, seekbar.y, pos, seekbar.h, colours.seekbar_progress); 97 | // Draw a rectangle around the seekbar 98 | gr.DrawRect(seekbar.x, seekbar.y, seekbar.w + _scale(6), seekbar.h, 1, colours.background); 99 | // Draw the seekbar cursor 100 | let cursorExtraHeight = 16; 101 | gr.FillSolidRect(seekbar.x + pos, seekbar.y - (cursorExtraHeight / 2), _scale(6), seekbar.h + cursorExtraHeight, colours.seekbar_knob); 102 | // Display the playback time 103 | gr.GdiDrawText(tfo.playback_time.Eval(), font.itemsEmphasized, colours.time, seekbar.x - _scale(45), 0, _scale(45), panel.h, RIGHT); 104 | // Display the playback length and time remaining 105 | gr.GdiDrawText(tfo.length.Eval(), font.itemsEmphasized, colours.time, seekbar.x + seekbar.w + _scale(6), 0, _scale(70), panel.h, LEFT); 106 | } 107 | } else { 108 | // Display placeholders for the playback time, playback length and time remaining 109 | gr.GdiDrawText('-:-- ', font.itemsEmphasized, colours.time, seekbar.x - _scale(45), 0, _scale(45), panel.h, RIGHT); 110 | gr.GdiDrawText(' -:-- / --:--', font.itemsEmphasized, colours.time, seekbar.x + seekbar.w + _scale(6), 0, _scale(70), panel.h, LEFT); 111 | } 112 | } 113 | 114 | function on_playback_edited() { 115 | window.Repaint(); 116 | } 117 | 118 | function on_playback_new_track(metadb) { 119 | if (!metadb) { 120 | return; 121 | } 122 | window.Repaint(); 123 | } 124 | 125 | function on_playback_pause() { 126 | window.Repaint(); 127 | } 128 | 129 | function on_playback_starting() { 130 | window.Repaint(); 131 | } 132 | 133 | function on_playback_seek() { 134 | seekbar.playback_seek(); 135 | } 136 | 137 | function on_playback_stop() { 138 | window.Repaint(); 139 | } 140 | 141 | function on_size() { 142 | panel.size(); 143 | seekbar.x = Math.round(panel.w * 0.10); 144 | seekbar.w = panel.w - seekbar.x - _scale(100); 145 | seekbar.h = _scale(12); 146 | seekbar.y = (panel.h - seekbar.h) / 2; 147 | } 148 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | 3 | ## About 4 | 5 | A set of miscellaneous scripts for personal use. Feel free to adapt them for your own needs. 6 | 7 | ## Attributions 8 | 9 | Please note that certain scripts are based on existing documentation, or are adapted from existing code found online, or use other softwares. 10 | 11 | **`autohotkey`** 12 | 13 | - `soundcard_analysis.ahk` has been directly taken from this [page](https://www.autohotkey.com/docs/commands/SoundSet.htm) of the AutoHotKey documentation. 14 | 15 | **`batch`** 16 | 17 | - `add_spacer_to_taskbar.bat` is adapted from code found in this [thread](https://superuser.com/questions/392061/how-to-make-a-shortcut-from-cmd) on Stack Overflow. 18 | - `convert_microsoft_office_to_pdf.vbs` contains code which has been written on this [blog post](http://www.thoughtasylum.com/blog/2012/12/20/vbscript-to-convert-microsoft-office-files-word-excel-powerp.html) by Thought Asylum. The associated batch file is original work, and still works with both Microsoft Office 2013 and 2016. 19 | - `export_putty_settings_and_sessions.bat` has been directly taken from this [thread](https://stackoverflow.com/questions/13023920/how-to-export-putty-sessions-list) on Stack Overflow. 20 | - `manage_pictures.bat` uses the amazing [ExifTool](https://www.sno.phy.queensu.ca/~phil/exiftool/) by Phil Harvey. 21 | - `rebuild_icon_cache.bat` has been directly taken from this [tutorial](https://www.tenforums.com/tutorials/5645-rebuild-icon-cache-windows-10-a.html) on Windows Ten Forums. 22 | - `remove_adobe_acrobat_browser_extension.reg` uses adapted code from this [thread](https://stackoverflow.com/questions/6836566/batch-file-delete-all-files-and-folders-in-a-directory) on Stack Overflow. 23 | - `switch_to_dark_mode.bat` and `switch_to_light_mode.bat` have been directly taken from this [article](https://www.howtogeek.com/356087/how-to-automatically-enable-windows-10s-dark-theme-at-night/) on How-To Geek. 24 | - `turn_hyper-v_off.bat` and `turn_hyper-v_on.bat` have been directly taken from this [thread](https://stackoverflow.com/questions/30496116/how-to-disable-hyper-v-in-command-line) on Stack Overflow. 25 | 26 | **`firefox`** 27 | 28 | - [Disable or re-enable Pocket for Firefox](https://support.mozilla.org/en-US/kb/disable-or-re-enable-pocket-for-firefox) 29 | 30 | **`powershell`** 31 | 32 | - `add_content_every_line_start.ps1` is adapted from code found in this [article](http://www.dreamsharepoint.com/powershell-add-something-to-the-end-of-each-line-in-a-text-file/) on DreamSharePoint. 33 | - `get_chkdsk_results.ps1` is adapted from code found in this [tutorial](https://www.sevenforums.com/tutorials/96938-check-disk-chkdsk-read-event-viewer-log.html) on Windows Seven Forums. 34 | - `set_windows_defender_cpu_usage_limit.ps1` is adapted from code found in this [article](https://korben.info/comment-reduire-la-consommation-de-cpu-de-windows-defender.html) by Korben. 35 | 36 | **`registry`** 37 | 38 | - `add_copy_to_folder_and_move_to_folder_context_menu.reg` has been directly taken from this [tutorial](https://www.tenforums.com/tutorials/29141-add-copy-folder-move-folder-context-menu-windows-10-a.html) on Windows Ten Forums. 39 | - `clear_mpc-hc_favorites.reg` is adapted from code found in this [thread](https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator) on Stack Overflow. 40 | - `disable_activity_history.reg` has been directly taken from this [tutorial](https://www.tenforums.com/tutorials/100341-enable-disable-collect-activity-history-windows-10-a.html) on Windows Ten Forums. 41 | - `disable_cloud-delivered_protection_and_automatic_sample_submission.reg` has been directly taken from this [tutorial](https://windowsreport.com/disable-windows-defender-cloud-based-automatic-sample-submission/) on Windows Report. 42 | - `disable_Bing_searches.reg` has been directly taken from this [article](https://www.howtogeek.com/224159/how-to-disable-bing-in-the-windows-10-start-menu/) on How-To Geek. 43 | - `disable_Cortana.reg` has been directly taken from this [article](https://www.howtogeek.com/265027/how-to-disable-cortana-in-windows-10/) on How-To Geek. 44 | - `fix_asus_smart_gesture_cpu_usage.reg` has been created from information found in this [thread](https://superuser.com/questions/897488/asus-smart-gesture-getting-cpu-to-3ghz) on Super User. 45 | - `remove_3D_Objects_folder.reg` and `restore_3D_Objects_folder.reg` have been directly taken from this [article](https://www.howtogeek.com/331361/how-to-remove-the-3d-objects-folder-from-this-pc-on-windows-10/) on How-To Geek. 46 | - `remove_all_user_folders_to_this_pc.reg` and `restore_all_user_folders_to_this_pc.reg` have been directly taken from this [article](https://www.howtogeek.com/222057/how-to-remove-the-folders-from-%E2%80%9Cthis-pc%E2%80%9D-on-windows-10/) on How-To Geek. 47 | - `remove_onedrive_to_file_explorer.reg` and `restore_onedrive_to_file_explorer.reg` have been directly taken from this [article](https://www.howtogeek.com/225973/how-to-disable-onedrive-and-remove-it-from-file-explorer-on-windows-10/) on How-To Geek. 48 | - `turn_start_menu_web_searches_off.reg` has been directly taken from this [article](https://www.howtogeek.com/224159/how-to-disable-bing-in-the-windows-10-start-menu/) on How-To Geek. 49 | - `remove_shortcut_text` and `restore_shortcut_text_to_default.reg` have been directly taken from this [article](https://www.howtogeek.com/howto/windows-vista/remove-shortcut-text-from-new-shortcuts-in-vista/) on How-To Geek. 50 | 51 | ## License 52 | 53 | Distributed under the [MIT license](http://opensource.org/licenses/MIT). -------------------------------------------------------------------------------- /calibre/ebook_reader_solarized_dark_theme.css: -------------------------------------------------------------------------------- 1 | article, 2 | aside, 3 | details, 4 | figcaption, 5 | figure, 6 | footer, 7 | header, 8 | hgroup, 9 | nav, 10 | section, 11 | summary { 12 | display: block; 13 | } 14 | audio, 15 | canvas, 16 | video { 17 | display: inline-block; 18 | } 19 | audio:not([controls]) { 20 | display: none; 21 | height: 0; 22 | } 23 | [hidden] { 24 | display: none; 25 | } 26 | html { 27 | font-family: sans-serif; 28 | -webkit-text-size-adjust: 100%; 29 | -ms-text-size-adjust: 100%; 30 | } 31 | body { 32 | margin: 0; 33 | } 34 | a:focus { 35 | outline: thin dotted; 36 | } 37 | a:active, 38 | a:hover { 39 | outline: 0; 40 | } 41 | h1 { 42 | font-size: 2em; 43 | } 44 | abbr[title] { 45 | border-bottom: 1px dotted; 46 | } 47 | b, 48 | strong { 49 | font-weight: bold; 50 | } 51 | dfn { 52 | font-style: italic; 53 | } 54 | mark { 55 | background: #ff0; 56 | color: #000; 57 | } 58 | code, 59 | kbd, 60 | pre, 61 | samp { 62 | font-family: monospace, serif; 63 | font-size: 1em; 64 | } 65 | pre { 66 | white-space: pre-wrap; 67 | word-wrap: break-word; 68 | } 69 | q { 70 | quotes: "\201C" "\201D" "\2018" "\2019"; 71 | } 72 | small { 73 | font-size: 80%; 74 | } 75 | sub, 76 | sup { 77 | font-size: 75%; 78 | line-height: 0; 79 | position: relative; 80 | vertical-align: baseline; 81 | } 82 | sup { 83 | top: -0.5em; 84 | } 85 | sub { 86 | bottom: -0.25em; 87 | } 88 | img { 89 | border: 0; 90 | } 91 | svg:not(:root) { 92 | overflow: hidden; 93 | } 94 | figure { 95 | margin: 0; 96 | } 97 | fieldset { 98 | border: 1px solid #c0c0c0; 99 | margin: 0 2px; 100 | padding: 0.35em 0.625em 0.75em; 101 | } 102 | legend { 103 | border: 0; 104 | padding: 0; 105 | } 106 | button, 107 | input, 108 | select, 109 | textarea { 110 | font-family: inherit; 111 | font-size: 100%; 112 | margin: 0; 113 | } 114 | button, 115 | input { 116 | line-height: normal; 117 | } 118 | button, 119 | html input[type="button"], 120 | input[type="reset"], 121 | input[type="submit"] { 122 | -webkit-appearance: button; 123 | cursor: pointer; 124 | } 125 | button[disabled], 126 | input[disabled] { 127 | cursor: default; 128 | } 129 | input[type="checkbox"], 130 | input[type="radio"] { 131 | box-sizing: border-box; 132 | padding: 0; 133 | } 134 | input[type="search"] { 135 | -webkit-appearance: textfield; 136 | -moz-box-sizing: content-box; 137 | -webkit-box-sizing: content-box; 138 | box-sizing: content-box; 139 | } 140 | input[type="search"]::-webkit-search-cancel-button, 141 | input[type="search"]::-webkit-search-decoration { 142 | -webkit-appearance: none; 143 | } 144 | button::-moz-focus-inner, 145 | input::-moz-focus-inner { 146 | border: 0; 147 | padding: 0; 148 | } 149 | textarea { 150 | overflow: auto; 151 | vertical-align: top; 152 | } 153 | table { 154 | border-collapse: collapse; 155 | border-spacing: 0; 156 | } 157 | html { 158 | font-family: 'PT Sans', sans-serif; 159 | } 160 | pre, 161 | code { 162 | font-family: 'Inconsolata', sans-serif; 163 | } 164 | h1, 165 | h2, 166 | h3, 167 | h4, 168 | h5, 169 | h6 { 170 | font-family: 'PT Sans Narrow', sans-serif; 171 | font-weight: 700; 172 | } 173 | html { 174 | background-color: #073642; 175 | color: #839496; 176 | } 177 | body { 178 | background-color: #002b36; 179 | margin: 0 auto; 180 | max-width: 23cm; 181 | border: 1pt solid #586e75; 182 | padding: 1em; 183 | } 184 | code { 185 | background-color: #073642; 186 | padding: 2px; 187 | } 188 | a { 189 | color: #b58900; 190 | } 191 | a:visited { 192 | color: #cb4b16; 193 | } 194 | a:hover { 195 | color: #cb4b16; 196 | } 197 | h1 { 198 | color: #d33682; 199 | } 200 | h2, 201 | h3, 202 | h4, 203 | h5, 204 | h6 { 205 | color: #859900; 206 | } 207 | code { 208 | background-color: #93a1a1; 209 | } 210 | pre { 211 | background-color: #93a1a1; 212 | color: #839496; 213 | border: 1pt solid #586e75; 214 | padding: 1em; 215 | box-shadow: 5pt 5pt 8pt #073642; 216 | } 217 | pre code { 218 | background-color: #93a1a1; 219 | } 220 | h1 { 221 | font-size: 2.8em; 222 | } 223 | h2 { 224 | font-size: 2.4em; 225 | } 226 | h3 { 227 | font-size: 1.8em; 228 | } 229 | h4 { 230 | font-size: 1.4em; 231 | } 232 | h5 { 233 | font-size: 1.3em; 234 | } 235 | h6 { 236 | font-size: 1.15em; 237 | } 238 | .tag { 239 | background-color: #073642; 240 | color: #d33682; 241 | padding: 0 0.2em; 242 | } 243 | .todo, 244 | .next, 245 | .done { 246 | color: #002b36; 247 | background-color: #dc322f; 248 | padding: 0 0.2em; 249 | } 250 | .tag { 251 | -webkit-border-radius: 0.35em; 252 | -moz-border-radius: 0.35em; 253 | border-radius: 0.35em; 254 | } 255 | .TODO { 256 | -webkit-border-radius: 0.2em; 257 | -moz-border-radius: 0.2em; 258 | border-radius: 0.2em; 259 | background-color: #2aa198; 260 | } 261 | .NEXT { 262 | -webkit-border-radius: 0.2em; 263 | -moz-border-radius: 0.2em; 264 | border-radius: 0.2em; 265 | background-color: #268bd2; 266 | } 267 | .ACTIVE { 268 | -webkit-border-radius: 0.2em; 269 | -moz-border-radius: 0.2em; 270 | border-radius: 0.2em; 271 | background-color: #268bd2; 272 | } 273 | .DONE { 274 | -webkit-border-radius: 0.2em; 275 | -moz-border-radius: 0.2em; 276 | border-radius: 0.2em; 277 | background-color: #859900; 278 | } 279 | .WAITING { 280 | -webkit-border-radius: 0.2em; 281 | -moz-border-radius: 0.2em; 282 | border-radius: 0.2em; 283 | background-color: #cb4b16; 284 | } 285 | .HOLD { 286 | -webkit-border-radius: 0.2em; 287 | -moz-border-radius: 0.2em; 288 | border-radius: 0.2em; 289 | background-color: #d33682; 290 | } 291 | .NOTE { 292 | -webkit-border-radius: 0.2em; 293 | -moz-border-radius: 0.2em; 294 | border-radius: 0.2em; 295 | background-color: #d33682; 296 | } 297 | .CANCELLED { 298 | -webkit-border-radius: 0.2em; 299 | -moz-border-radius: 0.2em; 300 | border-radius: 0.2em; 301 | background-color: #859900; 302 | } -------------------------------------------------------------------------------- /batch/manage_pictures.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL 3 | SETLOCAL EnableExtensions EnableDelayedExpansion 4 | 5 | ECHO [NOTE] This script only process pictures in current folder 6 | 7 | SET LF=^ 8 | 9 | 10 | REM Two empty lines are required! 11 | 12 | REM Get number of pictures 13 | SET count=0 14 | FOR %%x in (*.jpg) DO SET /a count+=1 15 | 16 | REM Get script directory 17 | SET startDirectory=%~dp0 18 | 19 | REM Check that the script can run 20 | IF NOT EXIST "exiftool.exe" ( 21 | IF NOT EXIST "C:\ProgramData\Chocolatey\bin\exiftool.exe" ( 22 | IF NOT EXIST "%startDirectory%Apps\exiftool\exiftool.exe" ( 23 | ECHO [ERROR] ExifTool not found 24 | GOTO :EOF 25 | ) ELSE ( 26 | SET exif="%startDirectory%Apps\exiftool\exiftool.exe" 27 | ) 28 | ) ELSE ( 29 | SET exif="C:\ProgramData\Chocolatey\bin\exiftool.exe" 30 | ) 31 | ) ELSE ( 32 | SET exif="exiftool.exe" 33 | ) 34 | 35 | IF %count% EQU 0 ( 36 | ECHO [ERROR] No pictures found in current folder 37 | GOTO :EOF 38 | ) 39 | 40 | IF "%1" == "" ( 41 | 42 | ECHO No name provided 43 | SET /P answer="Do you want to enter a name (Y/n)? " 44 | IF /I {!answer!}=={n} (GOTO :NONAME) 45 | IF /I {!answer!}=={no} (GOTO :NONAME) 46 | 47 | SET /P name="Enter your name: " 48 | GOTO :CHECK 49 | 50 | :NONAME 51 | SET /P answer="Do you want to continue (Y/n)? " 52 | IF /I {!answer!}=={n} (GOTO :NO) 53 | IF /I {!answer!}=={no} (GOTO :NO) 54 | 55 | ECHO [INFO] Not using a name 56 | SET name= 57 | GOTO :CHECK 58 | 59 | :NO 60 | ECHO [ERROR] Operation aborted 61 | GOTO :EOF 62 | 63 | ) ELSE ( 64 | 65 | SET name=%1 66 | 67 | ) 68 | 69 | :CHECK 70 | 71 | SET /P answer="Do you want to check the pictures have a datetime (Y/n)? " 72 | IF /i {!answer!}=={n} (GOTO :PROCESS) 73 | IF /i {!answer!}=={no} (GOTO :PROCESS) 74 | 75 | SET number=1 76 | SET wrong=0 77 | FOR %%x in (*.jpg) DO ( 78 | ECHO [WORK] Checking "%%x" (!number!/%count%^) 79 | REM Get the date at which the picture has been taken 80 | SET datetime= 81 | FOR /f %%i in ('CALL %exif% -d "%%Y-%%m-%%d" -DateTimeOriginal -S -s "%%x"') DO SET datetime=%%i 82 | IF [!datetime!] == [] ( 83 | SET /a wrong+=1 84 | ECHO [MISSING] "%%x" does not have a datetime 85 | ) 86 | SET /a number+=1 87 | ) 88 | ECHO [INFO] %wrong% picture(s) do not have a datetime 89 | 90 | SET /P answer="Do you want to continue (Y/n)? " 91 | IF /i {!answer!}=={n} (GOTO :END) 92 | IF /i {!answer!}=={no} (GOTO :END) 93 | 94 | :PROCESS 95 | 96 | REM Get first argument fully qualified path name 97 | SET file=%~f1 98 | 99 | SET /P answer="Do you want to sort the pictures by datetime taken (Y/n)? " 100 | IF /i {!answer!}=={n} (GOTO :NOSORTING) 101 | IF /i {!answer!}=={no} (GOTO :NOSORTING) 102 | 103 | ECHO [INFO] Sorting pictures 104 | CALL %exif% "-FileNameNUL 157 | CALL %exif% -P -all= -all:all= -XMP:All= -IPTC:Keywords= -ThumbnailImage= -overwrite_original "%%x" >NUL 158 | CALL %exif% -overwrite_original -P -tagsFromFile "%%x-PROCESSING" -DateTimeOriginal "%%x" -Orientation "%%x" >NUL 159 | DEL "%%x-PROCESSING" >NUL 160 | SET /a number+=1 161 | ) 162 | 163 | :SORTING 164 | 165 | SET question=Do you want to sort pictures by!LF!- YYYY/MM/DD/Name (1)!LF!- YYYY/MM/DD (2)!LF!- MM/DD (3)!LF!- DD only (4)!LF!- Not sorting them (n)? 166 | ECHO !question! 167 | SET /P answer="Select your option: " 168 | IF /i !answer! EQU 1 (GOTO :CUSTOM) 169 | IF /i !answer! EQU 2 (GOTO :YEARS) 170 | IF /i !answer! EQU 3 (GOTO :MONTHS) 171 | IF /i !answer! EQU 4 (GOTO :DAYS) 172 | IF /i {!answer!}=={n} (GOTO :END) 173 | IF /i {!answer!}=={no} (GOTO :END) 174 | 175 | :CUSTOM 176 | 177 | CALL %exif% "-Directory 0) { 96 | // jump to the note if it was found 97 | script.log("found journal entry: " + headline); 98 | script.setCurrentNote(note); 99 | } else { 100 | // create a new journal entry note if it wasn't found 101 | // keep in mind that the note will not be created instantly on the disk 102 | script.log("creating new journal entry: " + headline); 103 | 104 | // Default folder. 105 | if (defaultFolder && defaultFolder !== '') { 106 | var msg = 'Jump to default folder \'' + defaultFolder + '\' before creating a new journal note.'; 107 | script.log('Attempt: ' + msg); 108 | var jump = script.jumpToNoteSubFolder(defaultFolder); 109 | if (jump) { 110 | script.log('Success: ' + msg); 111 | } else { 112 | script.log('Failed: ' + msg); 113 | } 114 | } 115 | 116 | // Create the new journal note. 117 | script.createNote("# " + headline + "\n\n" + noteBodyTemplate); 118 | 119 | // Default tags. 120 | if (defaultTags && defaultTags !== '') { 121 | defaultTags 122 | // Split on 0..* ws, 1..* commas, 0..* ws. 123 | .split(/\s*,+\s*/) 124 | .forEach(function(i) { 125 | script.log('Tag the new journal note with default tag: ' + i); 126 | script.tagCurrentNote(i); 127 | }); 128 | } 129 | } 130 | } 131 | 132 | /** 133 | * This function is called when a note gets stored to disk if 134 | * "Allow note file name to be different from headline" is enabled 135 | * in the settings 136 | * 137 | * It allows you to modify the name of the note file 138 | * Keep in mind that you have to care about duplicate names yourself! 139 | * 140 | * Return an empty string if the file name of the note should 141 | * not be modified 142 | * 143 | * @param {NoteApi} note - the note object of the stored note 144 | * @return {string} the file name of the note 145 | */ 146 | function handleNoteTextFileNameHook(note) { 147 | // the current note name is the fallback 148 | var fileName = note.name; 149 | 150 | // get a list of all assigned tag names 151 | var tagNameList = note.tagNames(); 152 | 153 | var isJournal = false; 154 | 155 | // check if the tag "journal" is attached to the note 156 | for (var i = 0; i < tagNameList.length; ++i) { 157 | if (tagNameList[i] === "journal") isJournal = true; 158 | } 159 | 160 | // if so, check if the note name is correct 161 | if (isJournal) { 162 | 163 | var journalDateRegex = /^journal-/; 164 | 165 | if (!journalDateRegex.test(fileName)) { 166 | 167 | var m = new Date(); 168 | 169 | var noteDate = m.getFullYear() + "-" + ("0" + (m.getMonth()+1)).slice(-2) + "-" + ("0" + m.getDate()).slice(-2); 170 | 171 | // if not, rename the note 172 | fileName = "journal-" + noteDate; 173 | 174 | var noteExists = script.noteExistsByFileName(fileName + ".md", note.id); 175 | if (noteExists) { 176 | script.log("Note already exists - abort rename operation"); 177 | return ''; 178 | } else { 179 | script.log("Renaming note to: " + fileName); 180 | return fileName; 181 | } 182 | 183 | } 184 | } 185 | 186 | return ''; 187 | } 188 | 189 | } 190 | -------------------------------------------------------------------------------- /autohotkey/shortcuts_compilation.ahk: -------------------------------------------------------------------------------- 1 | #NoTrayIcon 2 | #Persistent 3 | #SingleInstance force 4 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 5 | #Warn ; Enable warnings to assist with detecting common errors. 6 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 7 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 8 | SetTitleMatchMode 2 ; A window's title can contain WinTitle anywhere inside it to be a match. 9 | 10 | ;******************************************************* 11 | ; SETUP 12 | ;******************************************************* 13 | 14 | ;------------------------------------------------------- 15 | ; Global configuration 16 | ;------------------------------------------------------- 17 | EnableAzertyShortcuts := false 18 | switchedDesktop := false 19 | ;------------------------------------------------------- 20 | 21 | ;------------------------------------------------------- 22 | ; OSD for volume 23 | ;------------------------------------------------------- 24 | Gui, VolumeGui:New 25 | Gui VolumeGui:+LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item. 26 | Gui, VolumeGui:Color, FFD54F ; Set background color 27 | Gui, VolumeGui:Font, s32 w600, Arial ; Set a large font size (32-point). 28 | Gui, VolumeGui:Font,, Ubuntu Condensed ; Preferred font. 29 | Gui, VolumeGui:Add, Text, vOSDVolumeTextValue +Center, UNMUTE 30 | ;------------------------------------------------------- 31 | 32 | ;------------------------------------------------------- 33 | ; OSD for microphone 34 | ;------------------------------------------------------- 35 | Gui, MicrophoneGui:New 36 | Gui MicrophoneGui:+LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item. 37 | Gui, MicrophoneGui:Color, ef5350 ; Set background color 38 | Gui, MicrophoneGui:Font, s32 w600, Arial ; Set a large font size (32-point). 39 | Gui, MicrophoneGui:Font,, Ubuntu Condensed ; Preferred font. 40 | Gui, MicrophoneGui:Add, Text, vOSDMicrophoneTextValue w500 +Center, Default text 41 | ;------------------------------------------------------- 42 | 43 | ;;******************************************************* 44 | ; CUSTOM SHORTCUTS 45 | ;******************************************************* 46 | 47 | ;------------------------------------------------------- 48 | ; For debug purposes only - Reload the script 49 | ;------------------------------------------------------- 50 | ; CapsLock::Reload 51 | ;------------------------------------------------------- 52 | 53 | ;------------------------------------------------------- 54 | ; Keep window on top 55 | ;------------------------------------------------------- 56 | #If ; Context-insensitive hotkey 57 | !+^T:: Winset, Alwaysontop, , A 58 | ;------------------------------------------------------- 59 | 60 | ;------------------------------------------------------- 61 | ; Replace default calculator 62 | ;------------------------------------------------------- 63 | #If 64 | ^NumpadEnter::Run "C:\Program Files (x86)\Moffsoft FreeCalc\MoffFreeCalc.exe" 65 | ;------------------------------------------------------- 66 | 67 | ;------------------------------------------------------- 68 | ; Call Listary 69 | ;------------------------------------------------------- 70 | ; With Alt + Space 71 | #If 72 | !Space::Send !+^{=} 73 | ; With the down button of the mouse 74 | #If 75 | XButton1::Send !+^{[} 76 | ^RButton::Send !+^{[} 77 | ;------------------------------------------------------- 78 | 79 | ;------------------------------------------------------- 80 | ; Switch between the desktops 81 | ;------------------------------------------------------- 82 | ; With the up button of the mouse 83 | #If 84 | ^XButton1:: switchDesktop() ; 85 | XButton2:: switchDesktop() ; 86 | 87 | ; Function to switch between the desktops 88 | switchDesktop() 89 | { 90 | global switchedDesktop 91 | if switchedDesktop 92 | { 93 | SendEvent ^#{Right} 94 | switchedDesktop := false 95 | } 96 | else 97 | { 98 | SendEvent ^#{Left} 99 | switchedDesktop := true 100 | } 101 | } 102 | ;------------------------------------------------------- 103 | 104 | ;------------------------------------------------------- 105 | ; Cycle through open windows with the mouse 106 | ;------------------------------------------------------- 107 | #If ; All special Alt-tab actions are not affected by #IfWin or #If. 108 | ~RButton & MButton::AltTabMenu 109 | ~RButton & WheelDown::AltTab 110 | ~RButton & WheelUp::ShiftAltTab 111 | ;------------------------------------------------------- 112 | 113 | ;------------------------------------------------------- 114 | ; Toggle main microphone mute 115 | ; Here, 10 is the ID of my microphone. 116 | ;------------------------------------------------------- 117 | ShowMicrophoneOSD(CustomText) 118 | { 119 | SetTimer, HideMicrophoneOSD, 500 ; Hide after specified delay 120 | GuiControl, MicrophoneGui:Text, OSDMicrophoneTextValue, %CustomText% ; Set text 121 | Gui, MicrophoneGui:Show, x1325 y900 NoActivate ; NoActivate avoids deactivating the currently active window. 122 | return 123 | } 124 | 125 | HideMicrophoneOSD() 126 | { 127 | Gui, MicrophoneGui:Hide, 128 | } 129 | 130 | Pause:: 131 | SoundSet, +1, MASTER, mute, 10 132 | SoundGet, microphone_mute , , mute, 10 133 | ; -Var := "Microphone MUTE is " . microphone_mute 134 | if (microphone_mute = "ON") 135 | { 136 | showMicrophoneOSD("Microphone MUTED") 137 | } else { 138 | showMicrophoneOSD("Microphone ON AIR") 139 | } 140 | SetTimer, HideMicrophoneOSD, -2000 141 | return 142 | 143 | RemoveToolTip: 144 | ToolTip 145 | return 146 | ;------------------------------------------------------- 147 | 148 | ;------------------------------------------------------- 149 | ; Adjust volume by scrolling the mouse wheel over the taskbar 150 | ;------------------------------------------------------- 151 | MouseIsOver(WinTitle) { 152 | MouseGetPos,,, Win 153 | return WinExist(WinTitle . " ahk_id " . Win) 154 | } 155 | 156 | ShowVolumeOSD(CustomText) 157 | { 158 | SetTimer, HideVolumeOSD, 500 ; Hide after specified delay 159 | GuiControl, VolumeGui:Text, OSDVolumeTextValue, %CustomText% ; Set text 160 | Gui, VolumeGui:Show, xCenter y900 NoActivate ; NoActivate avoids deactivating the currently active window. 161 | return 162 | } 163 | 164 | HideVolumeOSD() 165 | { 166 | Gui, VolumeGui:Hide, 167 | } 168 | 169 | #If (MouseIsOver("ahk_class Shell_TrayWnd") or MouseIsOver("ahk_class Shell_SecondaryTrayWnd")) 170 | WheelUp:: 171 | Send {Volume_Up} 172 | SoundGet, master_volume 173 | ShowVolumeOSD(Round(master_volume)) 174 | return 175 | WheelDown:: 176 | Send {Volume_Down} 177 | SoundGet, master_volume 178 | ShowVolumeOSD(Round(master_volume)) 179 | return 180 | MButton:: 181 | Send {Volume_Mute} 182 | Sleep, 100 183 | SoundGet, Mute, Master, MUTE 184 | if (Mute = "ON") 185 | { 186 | ShowVolumeOSD("MUTE") 187 | } else { 188 | ShowVolumeOSD("UNMUTE") 189 | } 190 | return 191 | ;------------------------------------------------------- 192 | 193 | ;------------------------------------------------------- 194 | ; Toggle bookmarks toolbar in Firefox when pressing "`" 195 | ;------------------------------------------------------- 196 | #If WinActive("ahk_class MozillaWindowClass") 197 | SC029:: 198 | Send {Alt} 199 | Sleep 1 200 | Send {Right} 201 | Sleep 1 202 | Send {Right} 203 | Sleep 1 204 | Send {Down} 205 | Sleep 1 206 | Send {Right} 207 | Sleep 1 208 | Send {Down} 209 | Sleep 1 210 | Send {Enter 2} 211 | return 212 | ;------------------------------------------------------- 213 | 214 | ;======================================================= 215 | ; FOR AZERTY LAYOUT 216 | ;======================================================= 217 | 218 | ;------------------------------------------------------- 219 | ; Send backtick when pressing "²" 220 | ;------------------------------------------------------- 221 | #If EnableAzertyShortcuts 222 | +SC029::Send {U+0060} ; ` 223 | ;------------------------------------------------------- 224 | 225 | ;------------------------------------------------------- 226 | ; Send capital accented letters 227 | ;------------------------------------------------------- 228 | #If EnableAzertyShortcuts 229 | ^+9::Send {U+00C7} ; Ç 230 | ^+0::Send {U+00C0} ; À 231 | ^+7::Send {U+00C8} ; È 232 | ^+2::Send {U+00C9} ; É 233 | ;------------------------------------------------------- 234 | -------------------------------------------------------------------------------- /batch/convert_microsoft_office_to_pdf.vbs: -------------------------------------------------------------------------------- 1 | Option Explicit 2 | 3 | '--------------------- 4 | ' CONFIGURATION START 5 | '--------------------- 6 | 'Display a summary in a message box when the conversions are complete 7 | Const SUMMARY_DISPLAY = TRUE 8 | Const SUMMARY_TITLE = "Conversion Complete" 9 | 10 | 'File extensions for PDFs 11 | Const PDF_Extension = "pdf" 12 | 13 | 'Results for CheckFile Function 14 | Const CHECKFILE_OK = 0 15 | Const CHECKFILE_FileDoesNotExist = 1 16 | Const CHECKFILE_NotMSOFile = 2 17 | 18 | 'Settings to produce PDFs from the applications 19 | Const EXCEL_PDF = 0 20 | Const EXCEL_QualityStandard = 0 21 | Const WORD_PDF = 17 22 | Const POWERPOINT_PDF = 32 23 | 24 | 'File types returned from OfficeFileType function 25 | Const FILE_TYPE_NotOffice = 0 26 | Const FILE_TYPE_Word = 1 27 | Const FILE_TYPE_Excel = 2 28 | Const FILE_TYPE_PowerPoint = 3 29 | 30 | 'Valid file type lists 31 | Const FILE_TYPE_DELIMITER = "|" 32 | Dim g_strFileTypesWord 33 | g_strFileTypesWord="|DOC|DOCX|" 34 | Dim g_strFileTypesExcel 35 | g_strFileTypesExcel="|XLS|XLSX|" 36 | Dim g_strFileTypesPowerPoint 37 | g_strFileTypesPowerPoint="|PPT|PPTX|" 38 | '---------------------- 39 | ' CONFIGURATION FINISH 40 | '---------------------- 41 | 42 | 43 | 'Call the main routine 44 | Main 45 | '-------------------- 46 | ' MAIN ROUTINE START 47 | '-------------------- 48 | Sub Main() 49 | Dim colArgs, intCounter, objFSO, strFilePath 50 | 51 | 'Get the command line arguments for the script 52 | ' - Each chould be a file to be processed 53 | Set colArgs = Wscript.Arguments 54 | If colArgs.Count > 0 Then 55 | For intCounter = 0 to colArgs.Count - 1 56 | strFilePath = Wscript.Arguments(intCounter) 57 | 58 | 'Check we have a valid file and process it 59 | Select Case CheckFile(strFilePath) 60 | Case CHECKFILE_OK 61 | Select Case OfficeFileType(strFilePath) 62 | Case FILE_TYPE_Word 63 | SaveWordAsPDF strFilePath 64 | 65 | Case FILE_TYPE_Excel 66 | SaveExcelAsPDF strFilePath 67 | 68 | Case FILE_TYPE_PowerPoint 69 | SavePowerPointAsPDF strFilePath 70 | End Select 71 | 72 | Case CHECKFILE_FileDoesNotExist 73 | MsgBox """" & strFilePath & """", vbCritical, "File " & intCounter & " does not exist" 74 | WScript.Quit 75 | 76 | Case CHECKFILE_NotMSOFile 77 | MsgBox """" & strFilePath & """", vbCritical, "File " & intCounter & " is not a valid file type" 78 | WScript.Quit 79 | End Select 80 | Next 81 | Else 82 | 'If there's not even one argument/file to process then exit 83 | Msgbox "Please pass a file to this script", 48,"No File Provided" 84 | WScript.Quit 85 | End If 86 | 87 | 88 | 'Display an optional summary message 89 | If SUMMARY_DISPLAY then 90 | If colArgs.Count > 1 then 91 | MsgBox CStr(colArgs.Count) & " files converted.", vbInformation, SUMMARY_TITLE 92 | Else 93 | MsgBox "1 file converted.", vbInformation, SUMMARY_TITLE 94 | End If 95 | End If 96 | End Sub 97 | '--------------------- 98 | ' MAIN ROUTINE FINISH 99 | '--------------------- 100 | 101 | 102 | '-------------------- 103 | ' SUB-ROUTINES START 104 | '-------------------- 105 | Sub SaveExcelAsPDF(p_strFilePath) 106 | 'Save Excel file as a PDF 107 | 108 | 'Initialise 109 | Dim objExcel, objWorkbook 110 | Set objExcel = CreateObject("Excel.Application") 111 | 112 | 'Open the file 113 | Set objWorkbook = objExcel.Workbooks.Open(p_strFilePath) 114 | 115 | 'Save the PDF 116 | objWorkbook.ExportAsFixedFormat EXCEL_PDF, PathOfPDF(p_strFilePath), EXCEL_QualityStandard, TRUE, FALSE, , , FALSE 117 | 118 | 'Close the file and exit the application 119 | objWorkbook.Close FALSE 120 | objExcel.Quit 121 | End Sub 122 | 123 | 124 | Sub SaveWordAsPDF(p_strFilePath) 125 | 'Save Word file as a PDF 126 | 127 | 'Initialise 128 | Dim objWord, objDocument 129 | Set objWord = CreateObject("Word.Application") 130 | 131 | 'Open the file 132 | Set objDocument = objWord.Documents.Open(p_strFilePath) 133 | 134 | 'Save the PDF 135 | objDocument.SaveAs PathOfPDF(p_strFilePath), WORD_PDF 136 | 137 | 'Close the file and exit the application 138 | objDocument.Close FALSE 139 | objWord.Quit 140 | End Sub 141 | 142 | 143 | Sub SavePowerPointAsPDF(p_strFilePath) 144 | 'Save PowerPoint file as a PDF (slides only) 145 | 146 | 'Initialise 147 | Dim objPowerPoint, objSlideDeck 148 | Set objPowerPoint = CreateObject("PowerPoint.Application") 149 | 150 | 'PowerPoint errors if it isn't visible :-( 151 | 'objPowerPoint.Visible = TRUE 152 | 153 | 'Open the file 154 | Set objSlideDeck = objPowerPoint.Presentations.Open(p_strFilePath, , , FALSE) 155 | 156 | 'Save the PDF 157 | objSlideDeck.SaveAs PathOfPDF(p_strFilePath), POWERPOINT_PDF, True 158 | 159 | 'Close the file and exit the application 160 | objSlideDeck.Close 161 | objPowerPoint.Quit 162 | End Sub 163 | '--------------------- 164 | ' SUB-ROUTINES FINISH 165 | '--------------------- 166 | 167 | 168 | '----------------- 169 | ' FUNCTIONS START 170 | '----------------- 171 | Function CheckFile(p_strFilePath) 172 | 'Check file exists and is an office file (Excel, Word, PowerPoint) 173 | 174 | 'Initialise 175 | Dim objFSO 176 | Set objFSO = CreateObject("Scripting.FileSystemObject") 177 | 178 | 'Check the file exists and is an office file 179 | If IsOfficeFile(p_strFilePath) then 180 | If objFSO.FileExists(p_strFilePath) then 181 | CheckFile = CHECKFILE_OK 182 | Else 183 | CheckFile = CHECKFILE_FileDoesNotExist 184 | End If 185 | Else 186 | CheckFile = CHECKFILE_NotMSOFile 187 | End If 188 | End Function 189 | 190 | 191 | Function OfficeFileType(p_strFilePath) 192 | 'Returns the type of office file, based upon file extension 193 | 194 | OfficeFileType = FILE_TYPE_NotOffice 195 | 196 | If IsWordFile(p_strFilePath) then 197 | OfficeFileType = FILE_TYPE_Word 198 | End If 199 | 200 | If IsExcelFile(p_strFilePath) then 201 | OfficeFileType = FILE_TYPE_Excel 202 | End If 203 | 204 | If IsPowerPointFile(p_strFilePath) then 205 | OfficeFileType = FILE_TYPE_PowerPoint 206 | End If 207 | End Function 208 | 209 | Function IsOfficeFile(p_strFilePath) 210 | 'Returns true if a file is an office file (Excel, Word, PowerPoint) 211 | 212 | IsOfficeFile = IsWordFile(p_strFilePath) OR IsExcelFile(p_strFilePath) OR IsPowerPointFile(p_strFilePath) 213 | End Function 214 | 215 | 216 | Function IsWordFile(p_strFilePath) 217 | 'Returns true if a file is a Word file 218 | 219 | IsWordFile = IsInList(GetFileExtension(p_strFilePath), g_strFileTypesWord) 220 | End Function 221 | 222 | 223 | Function IsExcelFile(p_strFilePath) 224 | 'Returns true if a file is an Excel file 225 | 226 | IsExcelFile = IsInList(GetFileExtension(p_strFilePath), g_strFileTypesExcel) 227 | End Function 228 | 229 | 230 | Function IsPowerPointFile(p_strFilePath) 231 | 'Returns true if a file is a PowerPoint file 232 | 233 | IsPowerPointFile = IsInList(GetFileExtension(p_strFilePath), g_strFileTypesPowerPoint) 234 | End Function 235 | 236 | 237 | Function IsInList(p_strSearchFor, p_strSearchIn) 238 | 'Search a delimited list for a text string and return true if it's found 239 | 240 | Dim intResult 241 | 242 | intResult = InStr(1, p_strSearchIn, FILE_TYPE_DELIMITER & p_strSearchFor & FILE_TYPE_DELIMITER, vbTextCompare) 243 | 244 | If IsNull(intResult) then 245 | IsInList = FALSE 246 | Else 247 | If intResult = 0 then 248 | IsInList = FALSE 249 | Else 250 | IsInList = TRUE 251 | End If 252 | End If 253 | End Function 254 | 255 | 256 | Function GetFileExtension(p_strFilePath) 257 | 'Return the file extension from a file path 258 | 259 | Dim objFSO 260 | Set objFSO = CreateObject("Scripting.FileSystemObject") 261 | GetFileExtension = objFSO.GetExtensionName(p_strFilePath) 262 | End Function 263 | 264 | 265 | Function PathOfPDF(p_strOriginalFilePath) 266 | 'Return the path for the PDF file 267 | 'The path will be the same as the original file but with a different file extension 268 | 269 | Dim objFSO 270 | 271 | 'Initialise 272 | Set objFSO = CreateObject("Scripting.FileSystemObject") 273 | 274 | 'Build the file path 275 | 'Set the directory 276 | PathOfPDF = objFSO.GetParentFolderName(p_strOriginalFilePath) & "\" 277 | 278 | 'Add the original file name without the extension 279 | PathOfPDF = PathOfPDF & Left(objFSO.GetFileName(p_strOriginalFilePath), Len(objFSO.GetFileName(p_strOriginalFilePath)) - Len(objFSO.GetExtensionName(p_strOriginalFilePath))) 280 | 281 | 'Finally add the the new file extension 282 | PathOfPDF = PathOfPDF & PDF_Extension 283 | End Function 284 | '------------------ 285 | ' FUNCTIONS FINISH 286 | '------------------ --------------------------------------------------------------------------------