Skip to content

Instantly share code, notes, and snippets.

View hlorand's full-sized avatar
👾

Lorand Horvath hlorand

👾
View GitHub Profile
@hlorand
hlorand / chrome-fix-macos.sh
Created May 25, 2022 11:14
Fix: Chrome not starting or crashing on patched MacOS Catalina
#!/bin/sh
sudo xattr -lr /Applications/Google\ Chrome.app
sudo xattr -cr /Applications/Google\ Chrome.app
sudo codesign -f -s - /Applications/Google\ Chrome.app
@hlorand
hlorand / archive-org-uploader.sh
Last active May 18, 2022 22:47
Uploads files to your archive.org account
#!/bin/bash
#######################
# Usage:
# ./upload.sh <foldername> <filename>
#
# Foldername must be globally unique.
# Fill in the USER and PASS variable below.
#
# Known issues: filename with spaces or filename with full or relative path
@hlorand
hlorand / 3d-cube.py
Last active March 1, 2023 21:54
3D rotating cube in Python - only 15 lines of code https://imgur.com/87vnopo.gif
# 3D rotating cube in Python - only 15 lines of code https://imgur.com/87vnopo.gif
import tkinter, math, time
c = tkinter.Canvas(tkinter.Tk(), width=600, height=600)
c.pack()
while t := int(time.time()*60) :
c.update()
c.delete("all"); n = []
@hlorand
hlorand / video-brightness-bookmarklet.js
Created January 31, 2022 10:32
Decrease video brightness bookmarklet
javascript:(function(){document.querySelector("video").style.filter = "brightness(0.5)";})()
@hlorand
hlorand / example.hta
Created November 6, 2021 05:21
Sample Windows HTML Application (HTA) https://en.wikipedia.org/wiki/HTML_Application
<HTML>
<HEAD>
<HTA:APPLICATION ID="HelloExample"
BORDER="thin"
SCROLL="no"
BORDERSTYLE="complex"/>
<TITLE>HTA - Hello World</TITLE>
<script>
function fv(){
alert("hello");
@hlorand
hlorand / youtube-merge-channel-rss.php
Created November 1, 2021 00:22
Merge YouTube channel RSSs into single RSS channel
<?php
header('Content-type: application/xml');
echo "<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'>\n";
echo "<channel>\n";
echo "<title>YouTube Channels RSS Feed</title>\n";
echo "<description>YouTube Channels RSS Feed</description>\n";
echo "<link>http://{$_SERVER[HTTP_HOST]}</link>\n";
echo "<atom:link href='http://{$_SERVER[HTTP_HOST]}' rel='self' type='application/rss+xml' />\n";
// Feed URLs - https://commentpicker.com/youtube-channel-id.php
@hlorand
hlorand / listing.sh
Created September 28, 2021 11:17
File listing generator
#!/bin/bash
# Creates an index.html file from every mp3,mp4 embedded, and every pdf linked in the html.
echo -e "<meta charset='utf-8'>\n<h1> Archivum</h1>\n" >>index.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
if [ $(ls -1 *.mp4 | wc -l) -eq 1 ]
@hlorand
hlorand / simple-javascript-pomodoro-timer.html
Created August 22, 2021 17:42
Simple JavaScript pomoodro timer.
<!--
Pomodoro timer
--------------
The counter works unreliably when the tab is inactive (the browser slows down the counter).
TODO: Rewrite to date + time based solution instead of setInterval.
-->
<!DOCTYPE html>
@hlorand
hlorand / clamav-howto-osx.md
Created August 6, 2021 06:13
How to use ClamAV on OSX

Install MacPorts

sudo port install clamav

You have to locate ClamAV config files, type this, it will fail and print the config folder:

freshclam
@hlorand
hlorand / big500.sh
Created July 29, 2021 02:41
Biggest files and folders in bash
# The 500 biggest folders except Google Drive, Trash etc...
sudo du -hx / 2>/dev/null | sort -rh | grep -v "Google Drive" | grep -v "REPOS" | grep -v "Fotókönyvtár" | grep -v ".Trash" | grep -v "CameraUploads" | head -500
# The 500 biggest file that is older than 1 year
sudo find / -type f -mtime +365 -exec ls -laT {} \; 2>/dev/null | awk '{print $5,$9,$10}' | sort -rh | head -500