Skip to content

Instantly share code, notes, and snippets.

View anvanvan's full-sized avatar

An Van anvanvan

View GitHub Profile
@anvanvan
anvanvan / new safari window.scpt
Created November 20, 2023 00:12
Creates a new Safari window and bring it to the foreground
tell application "Safari"
make new document
activate
end tell
@anvanvan
anvanvan / Sort-Files.ps
Created November 17, 2023 05:50
This PowerShell script recursively sorts image and video files in a specified folder by their creation date or media date, placing them into new directories named after the year and month of their creation or media date.
param(
[Parameter(Mandatory=$true)]
[string]$FolderPath
)
function Sort-Files {
Get-ChildItem -Path $FolderPath -File -Recurse | ForEach-Object {
#Write-Host "File: $_"
$creationDate = $_.CreationTime -replace("[^0-9/\:\sapm]")
$fileName = $_.Name
@anvanvan
anvanvan / .vimrc
Last active September 1, 2020 13:33
.vimrc for working on remote server
" 1. performance settings
set synmaxcol=300
set noshowmatch
set lazyredraw
set ttyfast
set nocursorline
" leader key
let mapleader = "\<space>"
set timeoutlen=1000 ttimeoutlen=0
@anvanvan
anvanvan / newfiles
Last active October 20, 2018 19:41 — forked from renekreijveld/jnewfiles
Bash script to detect suspicious new and changed files last 3 hours. Skips cache directories.
#!/bin/sh
# newfiles
# Detects new and changed php and html files last xxx minutes
# (C) 2014 Rene Kreijveld, enail [at] renekreijveld [dot] nl
# Update 31-12-2013: only send email when changes are found
# Update 04-02-2014: check for new files last three hours
# Update 05-05-2014: check for new html files also
# Update 07-05-2014: filter out ju_chached and DirectAdmin stats folders in html files