Skip to content

Instantly share code, notes, and snippets.

View sdenaro's full-sized avatar

sal sdenaro

View GitHub Profile
@amno1
amno1 / tail.el
Last active October 8, 2024 06:52
Tail & Head implementation in Emacs Lisp
Print the last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
Mandatory arguments to long options are mandatory for short options too.
-c, --bytes=[+]NUM output the last NUM bytes; or use -c +NUM to
output starting with byte NUM of each file
-f, --follow[={name|descriptor}]
output appended data as the file grows;
an absent option argument means 'descriptor'
-F same as --follow=name --retry
@bramus
bramus / bookmarklet.md
Last active September 20, 2024 07:01
Mastodon User Page Bookmarklet
@joeybaumgartner
joeybaumgartner / man2pdf.sh
Last active December 21, 2023 06:23
Script for opening PDF documents in Preview on macOS Ventura and newer.
#!/bin/sh
if [ $# -lt 1 ]
then
echo “man2pdf [man page name]”
exit
fi
tempfoo=`basename $0`
TMPPDFFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
@dxdxdt
dxdxdt / fuckyou-gmail.en.md
Last active September 7, 2023 17:44
What to do when Gmail marks all the mails from your server as spam

What to do when Gmail marks all the mails from your server as spam

If you're self-hosting your services and having trouble getting your emails through Gmail and infuriated by Google's non-existent support, you're not the only one. I'd like to share my experiences trying to get it sorted out.

I'm the author of the post above. You can tell how arrogant Google employees are from all the previous posts he made in the past.

function getLastResource(time, regex) {
let entries = performance.getEntriesByType('resource')
let last = null;
for(let i = 0; i < entries.length; i++) {
let e = entries[i];
if(regex && !e.name.match(regex)) continue;
if(e.responseEnd < time) last = e;
}
return last;
}
@IanColdwater
IanColdwater / twittermute.txt
Last active April 14, 2025 16:31
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@jcenters
jcenters / maclinkhandler
Created October 16, 2019 14:38
Link Handler for the Mac
#!/usr/bin/env sh
# Feed script a url or file location.
# If an image, it will view in the default image view (probably Preview),
# if a video or music file, it will view in mpv
# otherwise it opens link in browser.
# If no url given. Opens browser. For using script as $BROWSER.
[ -z "$1" ] && { "$BROWSER"; exit; }
@korakot
korakot / selenium.py
Last active November 21, 2024 06:30
Use selenium in Colab
# install chromium, its driver, and selenium
!apt update
!apt install libu2f-udev libvulkan1
!wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
!dpkg -i google-chrome-stable_current_amd64.deb
!wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/118.0.5993.70/linux64/chromedriver-linux64.zip
!unzip -j chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/
!pip install selenium chromedriver_autoinstaller
# set options to be headless, ..
@jakub-g
jakub-g / async-defer-module.md
Last active March 24, 2025 07:50
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@manekinekko
manekinekko / open-in-cloud-shell.md
Last active February 4, 2025 18:30
gcloud.tips: use the Google Cloud Shell to clone and edit a github repository

Open a github repository in the Cloud Shell

The Google Cloud Shell gives you a handy and quick Shell access to your Cloud instance. One thing you may not know is that you can use the Cloud Shell to clone and edit a Github project. Let's see how.

The trick here is to just call the following URL: https://console.cloud.google.com/cloudshell/open with the following parameters:

  1. git_repo: this is the URL to your github repository
  2. open_in_editor: this would be the file you want to open in the editor
  3. page=editor: this tells the cloud shell to open the code editor