Skip to content

Instantly share code, notes, and snippets.

@Prozi
Prozi / gist:e8bf94a050a29fdc8a0a0c6d8a606ac7
Created January 29, 2024 02:19
linux dir content size
alias dirsize="du --max-depth=1 -k * | sort -nr | cut -f2 | xargs -d '\n' du -sh"
@Prozi
Prozi / worker.js
Last active February 11, 2023 01:36
// Establish a cache name
const hostname = self.location.hostname.replace(".", "_")
const cacheName = hostname + "_cache"
// On fetch, function can't be async
// Otherwise the handler would not run
self.addEventListener("fetch", (event) => {
// Filter out queries not supported by cache
if (!event.request.url.match(/^https:\/\/?/)) {
return
{
"height": 20,
"infinite": false,
"layers": [
{
"data": [
70,
70,
70,
70,
Array.prototype.slice.call(
document.querySelectorAll('.MNGridView td.Amount > .MNText.StandardListAmount.Amount')
).map(o =>
o.innerText
.replace(/,/g, '.')
.replace(/\s/g, '')
).reduce((acc, next) => {
acc += parseFloat(next);
return acc;
}, 0);
@Prozi
Prozi / app.directives.parallax.js
Created August 18, 2016 21:13
angular1 parallax scroll directive
'use strict';
export default angular.module('myApp')
.directive('ngParallax', [
'myStorage',
(myStorage) => ({
restrict: 'AE',
scope: {
pattern: '=',
reverse: '=',
input=$(node -p "encodeURIComponent('${*//\'/\\\'}')")
google-chrome --start-fullscreen --chrome-frame --app="https://www.google.com/search?hl=en&btnI=I%27m+Feeling+Lucky&pws=0&q=$input"
#!/bin/bash
# resize files downscale 50% when bigger than 800kb - run until happy or from cron
find . -size 0 -print0 | xargs -0 rm
minimumsize=800000
for i in * ; do
actualsize=$(wc -c < "$i")
echo "parsing file $i"
if [ $actualsize -ge $minimumsize ]; then
convert "$i" -resize 50% "$i"
echo "ok"