Skip to content

Instantly share code, notes, and snippets.

@guychouk
guychouk / zetz
Last active May 9, 2023 23:25
⚡️ Zetz: simple note taking
#!/usr/bin/env bash
#
# _______| |_ ____
# |_ / _ \ __|_ /
# / / __/ |_ / /
# /___\___|\__/___|
#
# A note taking app for the terminal.
#
@guychouk
guychouk / macros.ahk
Last active March 15, 2021 11:36
🤖 macros.ahk - My macros AutoHotkey script.
; Config ;
#SingleInstance force ; Force a single instance of this script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Menu, Tray, icon, macros.ico ; Set system tray icon to robot arm
SetCapsLockState, AlwaysOff ; Set caps lock state to always be off
; Remappings ;
@guychouk
guychouk / msn-to-sqlite.py
Last active September 19, 2022 05:08
Insert MSN messenger chats XMLs to a SQLite DB.
'''
This script checks for the existence of a directory called "chats"
in the current working directory and looks for XML files to read.
Once the parsing is done, it creates an SQLite DB file, and a table
for storing the date, from, to, text and style attributes of the messages.
'''
import os
import sys
@guychouk
guychouk / scrape.php
Last active January 26, 2021 13:41
Example of using PHP's simple_html_dom package to scrape the EFA's website.
<?php
require 'simple_html_dom.php';
$baseUrl = "https://www.europeanfilmacademy.org/Presentation.presentation.0.html?&no_cache=1&uid=";
for ($i = 1866; $i <= 4500; $i++) {
$html = new simple_html_dom();
try {
$html->load_file($baseUrl . $i);
} catch (Exception $ex) {
@guychouk
guychouk / vim-keys.ahk
Last active March 10, 2021 19:46
Enable HJKL home row keys as arrows when Space key is pressed using AutoHotkey
; Recommended for performance and compatibility with future AutoHotkey releases.
#NoEnv
; Recommended for new scripts due to its superior speed and reliability.
SendMode Input
; Ensures a consistent starting directory.
SetWorkingDir %A_ScriptDir%
; Mentioned in the hotkeys docs for UP
Space & F1::Return
@guychouk
guychouk / schedule-task.ps1
Last active March 15, 2021 11:53
Register a Scheduled Task to run AutoHotkey script at Windows startup (specifically on user logon).
Register-ScheduledTask `
-TaskName "AHK-Macros" `
-Action $(New-ScheduledTaskAction -Execute "path\to\ahk.exe" -Argument "D:\Drive\etc\macros.ahk" -WorkingDirectory "D:\Drive\etc") `
-Trigger $(New-ScheduledTaskTrigger -AtLogOn) `
-Principal $(New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest)
@guychouk
guychouk / post-merge
Last active January 26, 2021 13:42
Post merge/pull hook to run npm command only if view files changed
#!/bin/bash
changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
runOnChange() {
echo "$changedFiles" | grep -q "$1" && eval "$2"
}
runOnChange resources/js/ "npm run <your-npm-script>"
runOnChange resources/scss/ "npm run <your-npm-script>"
@guychouk
guychouk / onedrive-hider.ps1
Last active January 26, 2021 13:43
A Powershell script to hide or show OneDrive in the explorer tree for Windows 10 (64-bit)
switch ($args[0]) {
"hide" {
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 0
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 0
break;
}
"show" {
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 1
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 1
break;
@guychouk
guychouk / media_sorter.py
Last active May 18, 2022 03:15
Python script for sorting images and videos by Years and Months based on EXIF & Media Created Info.
'''
Put this script in a messy folder filled with images and video files.
After running it, a "Years" folder will be created with the media files
sorted by months in each year.
You can also change what types of files to look for in your folder by
adding to or changing the "imgFormats" and "videoFormats" lists.
'''
import os