Skip to content

Instantly share code, notes, and snippets.

@rmateu
rmateu / Amazon_MD.js
Last active September 10, 2018 11:06 — forked from mokkunp/bookmarklet.md
Amazon Books Title, author and image bookmarklet.
var title = document.getElementById("ebooksProductTitle");
if (title == null) {
title = document.getElementById("productTitle")
};
title = title.innerText;
var imageUrl = document.getElementById("ebooksImgBlkFront");
if (imageUrl == null) {
imageUrl = document.getElementById("imgBlkFront")
};
imageUrl = imageUrl.src;
@retrography
retrography / rogue-killer.sh
Last active October 24, 2018 12:27
Assesses the most CPU-intensive (keeping at least one core busy at 100%) processes repetitively over a period of one second, and kills the process that comes on top.
#!/bin/bash
declare -a pids
for i in {1..10}
do
toptask=$(ps -eo pcpu=,pid= | sed 's/^ *//' | tr -s ' ' '\t' | sort -grk1 | head -1)
cpu=$(echo $toptask | tr -s ' ' '\t' | cut -f1 | cut -d. -f1)
pid=$(echo $toptask | tr -s ' ' '\t' | cut -f2)
if (( cpu > 100 )); then
@christopheranderton
christopheranderton / update-outdated-brew-casks.sh
Last active March 17, 2025 14:04
Upgrade outdated brew casks. One liner, and the ”official” way to do it without using different hacks or scripts. However, it does not really replace some scripts out there, as in-app updates is not seen by Homebrew.
# Upgrade / Update outdated casks installed.
# --------------------------------------------------------------------------------
# Looks for outdated casks and installs the the latest version.
# User data (like application preferences) is intact.
# Updated one liner (thanks Henrik242)
# --------------------------------------------------------------------------------
brew upgrade $(brew outdated --cask --greedy --quiet)
@aielwaste
aielwaste / macos_high_sierra_tweaks.md
Last active September 23, 2018 03:37
MacOS Sierra Tweaks

MacOS High Sierra Tweaks

disable gatekeeper

sudo spctl --master-disable
sudo defaults write /var/db/SystemPolicy-prefs.plist enabled -string no
defaults write com.apple.LaunchServices LSQuarantine -bool false

# disable disk iamge verification
@mcharo
mcharo / playbackRate.bookmarklets
Last active April 24, 2018 19:17
Video playback rate bookmarklets
//1.0:
javascript:(function()%7Bvar%20v%3Ddocument.getElementsByTagName(%22video%22)%5B0%5D%3Bif%20(typeof%20v%20!%3D%3D%20'undefined'%20%26%26%20v.currentTime%20%3E%200)%20%7Bv.playbackRate%20%3D%201%3Bconsole.log(%22playbackRate%20%3D%20%22%20%2B%20v.playbackRate)%3B%7D%7D)()
//+0.1:
javascript:(function()%7Bvar%20v%3Ddocument.getElementsByTagName(%22video%22)%5B0%5D%3Bif%20(typeof%20v%20!%3D%3D%20'undefined'%20%26%26%20v.currentTime%20%3E%200)%20%7Bvar%20pb%20%3D%20v.playbackRate%20%2B%20.1%3Bpb%20%3D%20pb.toFixed(1)%3Bv.playbackRate%20%3D%20pb%3Bconsole.log(%22playbackRate%20%3D%20%22%20%2B%20v.playbackRate)%3B%7D%7D)()
//-0.1:
javascript:(function()%7Bvar%20v%3Ddocument.getElementsByTagName(%22video%22)%5B0%5D%3Bif%20(typeof%20v%20!%3D%3D%20'undefined'%20%26%26%20v.currentTime%20%3E%200)%20%7Bvar%20pb%20%3D%20v.playbackRate%20-%20.1%3Bpb%20%3D%20pb.toFixed(1)%3Bv.playbackRate%20%3D%20pb%3Bconsole.log(%22playbackRate%20%3D%20%22%20%2B%20v.playbackRate)%3B%7D%7D)()
@emilefraser
emilefraser / mac-setup-script.sh
Last active September 3, 2024 18:09
[Mac Setup Script] #mac #install #configure
# Complete macOS Setup
# From clean install to fully configured.
# Step 1: Init Environment
#Temporarily Disable sudo Password Timeout
#The sudo password timeout is re-enabled at the end of this script. ##+BEGIN_SRC sh sudo tee /etc/sudoers.d/timeout > /dev/null <<-EOF Defaults timestamp_timeout=-1 EOF ##+END_SRC
##+BEGIN_SRC sh sudo tee /etc/sudoers.d/installer > /dev/null <<-EOF %admin ALL=(ALL) NOPASSWD:SETENV: /usr/sbin/installer EOF ##+END_SRC
@eoneill
eoneill / .bashrc
Last active March 1, 2019 18:48
[VSCode] some helpful bash additions
# if we have vscode installed...
if hash code 2>/dev/null; then
# VSCode as default editor
export EDITOR="code -w"
# VSCode command line currently does not support piping from stdin
# This helper function wraps the `code` command to capture piped stdin
function code() {
# reference to the original `code` command
local code=$(which code)
@thespacedoctor
thespacedoctor / convert list of uncompleted reminders and their notes to taskpaper format.applescript
Last active May 5, 2021 15:58
[MacOS Reminders to Taskpaper] convert list of uncompleted reminders and their notes to taskpaper format #taskpaper #reminders
-- OUTPUT A LIST OF UNCOMPLETED REMINDERS AND THEIR NOTES IN TASKPAPER FORMAT
tell application "Reminders"
set myList to "inbox"
if (count of (reminders in list myList whose completed is false)) > 0 then
set todoListNames to name of reminders in list myList whose completed is false
set todoListNotes to body of reminders in list myList whose completed is false
set output to ""
repeat with itemNum from 1 to (count of todoListNames)
set output to output & "- " & (item itemNum of todoListNames) & return
if item itemNum of todoListNotes exists then

Music for working, programming, reading, …

…sleeping, meditating, yoga, after hour…. Mostly ambient, drone, (neo-)classical, dub, minimal techno, deep house, micro house, downtempo, slo-mo house, ketapop, schneckno, jetlagdisco, post-rock, lowfi hip hop…

Please feel free to comment your recommendations.

@patmaddox
patmaddox / new_note.scpt
Last active May 27, 2018 09:11
applescript to make a new markdown note in DEVONthink and open it in an editor
display dialog "Name your note..." default answer ""
set theName to text returned of result
tell application id "DNtp"
set theID to "F76B0AC1-6B7B-45A2-ADE6-8514F54671F4"
set theGroup to get record with uuid theID
set theRecord to create record with {name:theName, type:markdown, content:"# " & theName} in theGroup
set theFile to path of theRecord as POSIX file
tell application "Finder" to open theFile
end tell