The requirement was to ensure that there was no impact on production while pulling down a set of mailboxes from exchange.
Fun fact, at the time this was written, exchange was already smart enough to perform error checking, limit the concurrent exports etc. It was all done under the hood.
But my manager was absolutely insistent that everything be done within our control, and he wasnt satisfied by Exchange documentation.
Its a relic now, I think exchange powershell commands have changed twice, shit I dont think exchange handles exports any more, but thats within the purview of microsoft purview.
It also represents maybe 1/3rd the energy I have devoted to powershell in my entire career.
alganet · 12h ago
This polyglot that work across many interpreters from within a single source, and create no temporary files:
These are recreational in nature. Crafting a source code that runs in many interpreters and does something meaningful is a fun brain tease.
1vuio0pswjnm7 · 12h ago
A one-liner script for shell output redirection that inserts instead of appends
Typically
cat file2 >> file1
If want to place file2 at the top of file1 instead of the bottom
cat file2 file1 > file3
mv file3 file1
Too much typing, margin for error
The script is called "ins"
ins file1 < file2
Can also use line number
ins file1 25 < file2
Inserts file2 at line 25 of file1
One of the most useful scripts I have ever written
Only uses sed or ed
DHRicoF · 12h ago
The only "real" thing I've done with ruby, many, many years ago.
A little script to extract the functions definitions from a FORTRAN project.
The idea was to add more data. Later I learned about ctags and never added another feature.
I'm sure there is a copy in an external ssd I lost 2 summers ago.
fullofdev · 12h ago
more like a template using Raycast for my daily work with customers
I have a lot of (legally acquired) shows and movies. I like making playlists with many shows that fit a theme (e.g. a cozy sitcoms playlist with MASH, Sanford and Son, Seinfeld, etc.). Some playlists have over 5000 episodes. I calculated one and it was almost a year of playtime if I only let it play while I'm sleeping (my primary use-case).
I want to shuffle the shows I'm watching, but I can't stand standard shuffling in VLC because it puts, for example, S8E4 before S1E1. Total loss of plot. So I wrote a shuffler that shuffles shows but keeps the episodes in order.
It deploys symlinks numbered 0-n, as well as an index of what episode each number corresponds to. Then I just slap the whole folder in VLC and let it play until I get bored of that theme.
I just make a copy of the script for each playlist and put it in the playlist folder. It has to be run as administrator on Windows, which is unfortunately where it's run at the moment because my gaming PC is also my TV for now, although I did just migrate everything to a Debian NFS server so I'll need to address that probably.
reify · 9h ago
being an android AOSP user I had no way to download or check for updates for signal messenger.
writing this bash script at nearly 70 years old was like getting my first degree.
it took me ages.
download-signal-script.sh
signal is now available in the Guardian project repo.
https://github.com/protocolture/petulant-exchange-export/blo...
Its the most useless script ever devised by man.
The requirement was to ensure that there was no impact on production while pulling down a set of mailboxes from exchange.
Fun fact, at the time this was written, exchange was already smart enough to perform error checking, limit the concurrent exports etc. It was all done under the hood.
But my manager was absolutely insistent that everything be done within our control, and he wasnt satisfied by Exchange documentation.
Its a relic now, I think exchange powershell commands have changed twice, shit I dont think exchange handles exports any more, but thats within the purview of microsoft purview.
It also represents maybe 1/3rd the energy I have devoted to powershell in my entire career.
https://gist.github.com/alganet/2c1c004d0580e8d92cc1c167fa4f...
It's quite small, simple and has no dependencies (mshta and zenity are just example calls).
There's a larger version that can do even more interpreters and even launch its own webview:
https://gist.github.com/alganet/9eec864a2caa44ef1f9ca2e188b8...
--
These are recreational in nature. Crafting a source code that runs in many interpreters and does something meaningful is a fun brain tease.
Typically
If want to place file2 at the top of file1 instead of the bottom Too much typing, margin for errorThe script is called "ins"
Can also use line number Inserts file2 at line 25 of file1One of the most useful scripts I have ever written
Only uses sed or ed
I'm sure there is a copy in an external ssd I lost 2 summers ago.
I have a lot of (legally acquired) shows and movies. I like making playlists with many shows that fit a theme (e.g. a cozy sitcoms playlist with MASH, Sanford and Son, Seinfeld, etc.). Some playlists have over 5000 episodes. I calculated one and it was almost a year of playtime if I only let it play while I'm sleeping (my primary use-case).
I want to shuffle the shows I'm watching, but I can't stand standard shuffling in VLC because it puts, for example, S8E4 before S1E1. Total loss of plot. So I wrote a shuffler that shuffles shows but keeps the episodes in order.
It deploys symlinks numbered 0-n, as well as an index of what episode each number corresponds to. Then I just slap the whole folder in VLC and let it play until I get bored of that theme.
I just make a copy of the script for each playlist and put it in the playlist folder. It has to be run as administrator on Windows, which is unfortunately where it's run at the moment because my gaming PC is also my TV for now, although I did just migrate everything to a Debian NFS server so I'll need to address that probably.
writing this bash script at nearly 70 years old was like getting my first degree.
it took me ages.
download-signal-script.sh
signal is now available in the Guardian project repo.
===========================
#! /bin/bash
# save json output to read shasums
curl -s https://updates.signal.org/android/latest.json -o json.txt
# save url from json to file
curl -s https://updates.signal.org/android/latest.json | jq ".url" -r >signal.txt
# show url
cat json.txt | jq ".url" -r
# remove files if selcted no and ext
trap "rm -f json.txt signal.txt" EXIT
# ask to continue
while true
do
done# download new signal update
xargs -n 1 curl -O < signal.txt
# extract the sha256sum from the url or json file
# curl -s https://updates.signal.org/android/latest.json | jq ".sha256sum" -r
# check the files sha256sum
cat signal.txt | echo | sha256sum *.apk
# compare shasums
cat json.txt | jq ".sha256sum" -r
===============================================