Skip to content

Instantly share code, notes, and snippets.

View NightMachinery's full-sized avatar

Feraidoon Mehri NightMachinery

  • LMU Munich
View GitHub Profile
@alana314
alana314 / testheadphones.sh
Created March 21, 2019 17:59
Test if headphones are plugged in -- OS X shell script
#!/bin/bash
if system_profiler SPAudioDataType | grep --quiet Headphones; then
echo plugged in
else
echo not plugged in
fi
@ericnormand
ericnormand / 00_script.clj
Last active April 23, 2025 16:46
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@reasonableperson
reasonableperson / sqlite3-git-smudge-filter.md
Last active March 26, 2021 01:20
sqlite3-git-smudge-filter

If you configure git like this:

git config filter.sqlite3.clean 'sqlite3 %f .dump'
git config filter.sqlite3.smudge 'sqlite3 %f'
echo '*.db filter=sqlite3' >> .git/info/attributes

and you have an sqlite3 database in a *.db file:

@CarlosDomingues
CarlosDomingues / python-poetry-cheatsheet.md
Last active March 23, 2026 03:34
Python Poetry Cheatsheet

Create a new project

poetry new <project-name>

Add a new lib

poetry add <library>

Remove a lib

@bgopikrishna
bgopikrishna / quoraTopicsUnfollow.js
Created January 1, 2019 05:06
A script to unfollow all topics in Quora at a time
//Wait for the topics to load
//Then execute the script
//Get all following Topics
const topicsFollowing = document.querySelectorAll('.ObjectCard-footer a')
function unFollowAll() {
topicsFollowing.forEach(topic => {
//clicking unFollow button
topic.click()
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active August 8, 2026 06:13
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@agumonkey
agumonkey / hn.el
Last active September 26, 2021 14:38
porting hackernews -> org-mode from js to elisp https://gist.github.com/dharmatech/2ef271907cb73298318fdb50a4ee7d54
;;; hn.el --- convert hacker news post into org-mode buffer -*- lexical-binding: t -*-
;; Copyright (C) 2018- Free Software Foundation, Inc.
;; Author: Johan Ponin <johan.ponin.pro@gmail.com>
;; Version: 0.0.1
;; Package-Version: 20181103.0001
;; Keywords: hackernews, org-mode
;; This program is free software; you can redistribute it and/or modify

The PowerShell script shown below can be used to archive a Hacker News post as an Emacs Org mode file.

Example invocation:

The post-to-org function is passed the story ID.

Resulting org file:

@vookimedlo
vookimedlo / macos_mute_unmute.md
Last active December 19, 2025 00:38
MacOS: mute & unmute from command line

Mute volume

osascript -e "set volume with output muted"

Unmute volume

osascript -e "set volume without output muted"
@NightMachinery
NightMachinery / book-notifier.zsh
Last active May 16, 2020 12:50
Notifies you when a book has become available on Libgen.
#!/usr/bin/env zsh
#Install libgen.py, GNU Timeout, and terminal-notifier (macOS only. Just delete the line for other OSes.). Use cron to check for a book regularly. (e.g., `0 9 * * * ~/book-notifier.zsh "little schemer"`)
gtimeout 6s libgen -s "$1" &> /dev/null
if [ $? -eq 124 ]; then
terminal-notifier -message "$1" -title "Book Has Become Available!"
echo "$1 is now available!"
fi