Skip to content

Instantly share code, notes, and snippets.

View Lugoues's full-sized avatar

Peter Brunner Lugoues

  • ThorTech Solutions
  • New York
View GitHub Profile
@ysimonson
ysimonson / bluetooth_sleep.lua
Last active March 26, 2024 03:47
Hammerspoon script to disable bluetooth when the computer is put to sleep. Requires `blueutil` to be installed (`brew install blueutil`).
require "string"
function checkBluetoothResult(rc, stderr, stderr)
if rc ~= 0 then
print(string.format("Unexpected result executing `blueutil`: rc=%d stderr=%s stdout=%s", rc, stderr, stdout))
end
end
function bluetooth(power)
print("Setting bluetooth to " .. power)
@vonNiklasson
vonNiklasson / sublime3-disable-zoom.sh
Last active March 7, 2022 13:44
Disable scroll zoom in Sublime 3, by Hugh Perkins from https://superuser.com/a/1121238
cat <<EOF>~/.config/sublime-text-3/Packages/User/"Default (Linux).sublime-mousemap"
[
// Change font size with ctrl+scroll wheel
{ "button": "scroll_down", "modifiers": ["ctrl"], "command": "null" },
{ "button": "scroll_up", "modifiers": ["ctrl"], "command": "null" }
]
EOF
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@ctechols
ctechols / compinit.zsh
Last active April 19, 2024 23:44
Speed up zsh compinit by only checking cache once a day.
# On slow systems, checking the cached .zcompdump file to see if it must be
# regenerated adds a noticable delay to zsh startup. This little hack restricts
# it to once a day. It should be pasted into your own completion file.
#
# The globbing is a little complicated here:
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
# - '.' matches "regular files"
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.
autoload -Uz compinit
@4lun
4lun / cmus-osx.md
Last active February 20, 2016 14:57
cmus on OSX (inc. mediakeys and lastfm integration)

cmus

Install

brew install cmus

cmusfm

Install

git clone git@github.com:Arkq/cmusfm.git

cd cmusfm

@unbracketed
unbracketed / branch-fu.md
Created April 7, 2015 17:49
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
cfg.parser () {
fixed_file=$(cat $1 | sed 's/ = /=/g') # fix ' = ' to be '='
IFS=$'\n' && ini=( $fixed_file ) # convert to line-array
ini=( ${ini[*]//;*/} ) # remove comments
ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix
ini=( ${ini[*]/%]/ \(} ) # convert text2function (1)
ini=( ${ini[*]/=/=\( } ) # convert item to array
ini=( ${ini[*]/%/ \)} ) # close array parenthesis
ini=( ${ini[*]/%\( \)/\(\) \{} ) # convert text2function (2)
ini=( ${ini[*]/%\} \)/\}} ) # remove extra parenthesis
#!/bin/sh
#
# cmus-status-display
#
# Usage:
# in cmus command ":set status_display_program=cmus-status-display"
#
# This scripts is executed by cmus when status changes:
# cmus-status-display key1 val1 key2 val2 ...
#
@atenni
atenni / README.md
Last active April 24, 2024 01:36
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@sergejusb
sergejusb / IIS-Functions.ps1
Last active February 9, 2018 11:46
Basic Power-Shell cmdlets to work with IIS 7+
# -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# IIS functions
Import-Module WebAdministration
function Test-WebAppPool($Name) {
return Test-Path "IIS:\AppPools\$Name"
}
function Get-WebAppPool($Name) {