Skip to content

Instantly share code, notes, and snippets.

View kevduc's full-sized avatar
📙
Focusing

Kevin Duconge kevduc

📙
Focusing
View GitHub Profile
@kevduc
kevduc / remove-apps.ps1
Last active October 6, 2021 23:24
Deletes Windows Apps and prevents install at setup (removes app folder in "C:\Program Files\WindowsApp", frees space)
# From https://superuser.com/questions/1465089/how-do-i-delete-a-windowsapps-folder/1619744
$appname = @(
"*LinkedInforWindows*"
"*Evernote*"
"*MusicMakerJam*"
"*GetHelp*"
"*Getstarted*"
"*Microsoft3DViewer*"
"*MicrosoftOfficeHub*"
@kevduc
kevduc / diary2html.m
Created September 25, 2021 22:16
Creates a formatted HTML version of a MATLAB diary file
function diary2html(filename)
% DIARY2HTML Creates a formatted HTML version of a diary file
% DIARY2HTML(FILENAME) outputs a formatted HTML version of a diary file
% to an HTML file (e.g. if filename is "diary.txt", the HTML file generated
% will be "diary.html")
arguments
filename (1,:) char {mustBeNonempty}
end
@kevduc
kevduc / mail.m
Created September 25, 2021 22:15
Example to send an email in MATLAB
myaddress = 'myemail@gmail.com';
setpref('Internet','E_mail',myaddress);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',myaddress);
setpref('Internet','SMTP_Password',mypassword);
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', ...
function y = isCarmichael(x)
y = false
if isprime(x)
return
end
for b = 2:x-1
if gcd(b,x) ~= 1; continue; end
@kevduc
kevduc / cprintf.m
Created September 25, 2021 22:14
Wraps the given string in html that colors that text
function cprintf(color, string)
%CPRINTF wraps the given string in html that colors that text.
disp(['<font color="', color, '">', string, '</font>']);
end
@kevduc
kevduc / disableBingSearch.reg
Created September 24, 2021 14:41
Disable Bing Search in Windows 10 (rendered obsolete by recent updates)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
"BingSearchEnabled"=dword:00000000
"AllowSearchToUseLocation"=dword:00000000
"CortanaConsent"=dword:00000000
@kevduc
kevduc / w8f_noautorebootwithloggedonusers.reg
Created September 24, 2021 14:23
Prevent auto reboot (e.g. after updates) when user is logged-in in Windows 8
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
"NoAutoRebootWithLoggedOnUsers"=dword:00000000
; "NoAutoRebootWithLoggedOnUsers"=dword:00000001
@kevduc
kevduc / windows-terminal-settings.json
Created September 23, 2021 04:15
JSON settings to add Git Bash and Node consoles to Windows Terminal
{
"commandline": "%PROGRAMFILES%/Git/bin/bash.exe -i -l",
"guid": "{b6dcc215-1356-4b6b-907b-61957457104a}",
"icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
"name": "Git Bash",
"startingDirectory": "%USERPROFILE%/Documents/Git",
"tabTitle": "Git Bash"
},
{
"commandline": "C:\\Program Files\\nodejs\\node.exe",
@kevduc
kevduc / git-remove-large-file.sh
Created September 21, 2021 01:27
Remove large file from commit history
#From https://www.deployhq.com/git/faqs/removing-large-files-from-git-history
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch path/to/file' --prune-empty --tag-name-filter cat -- --all
@kevduc
kevduc / watch-logs.ps1
Created September 20, 2021 15:25
Watch log files inside folder and copy them when changed
# From https://stackoverflow.com/questions/29066742/watch-file-for-changes-and-run-command-with-powershell
$folder = "C:\Users\LOCAL_~1\AppData\Local\Temp\3"
$filter = "*.log"
$destination = "C:\Users\Documents"
$Watcher = New-Object IO.FileSystemWatcher $folder, $filter -Property @{
IncludeSubdirectories = $false
NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'
}