Skip to content

Instantly share code, notes, and snippets.

View sarnobat's full-sized avatar

sarnobat

View GitHub Profile
@jthodge
jthodge / universal-switcher
Created September 6, 2020 22:07
Show macOS app switcher across all monitors
defaults write com.apple.Dock appswitcher-all-displays -bool true
killall Dock
@influx6
influx6 / restart-ssh.bash
Last active December 16, 2023 09:26
Restart SSH on Mac Terminal (High Sierra)
# high sierra
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
# latest
sudo vim /etc/services # (update the port config for ssh and save)
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
@drbh
drbh / change-iterm-background-color.sh
Last active November 9, 2023 10:17
Programmatically change the background color of iTerm - or set it randomly
set_term_bgcolor(){
local R=$1
local G=$2
local B=$3
/usr/bin/osascript <<EOF
tell application "iTerm"
tell current session of current window
set background color to {$(echo "scale=2; ($1/255.0)*65535" | bc),$(echo "scale=2; ($2/255.0)*65535" | bc),$(echo "scale=2; ($3/255.0)*65535" | bc)}
end tell
end tell
@rosswd
rosswd / cs.md
Last active April 13, 2023 17:16
The stack, heap, registers and instructions

Stack, Heap, Registers and Instructions

  1. Stack (push, pop, stack pointer, stack frame pointer)
  2. Heap (malloc, calloc, global, static)
  3. Registers (addresses, values)
  4. Instructions (mov, add, jmp, jne)

The Stack (LIFO)

  • push adds an element to the top of the stack
  • pop removes the top element from the stack
@fsteffenhagen
fsteffenhagen / sum_filesize.sh
Last active April 15, 2024 10:04
sum human readable file sizes with numfmt and awk
# Input: list of rows with format: "<filesize> filename", e.g.
# filesizes.txt
#######################
# 1000K file1.txt
# 200M file2.txt
# 2G file3.txt
#
# Output:
cat filesizes.txt | numfmt --from=iec | awk 'BEGIN {sum=0} {sum=sum+$1} END {printf "%.0f\n", sum}'
@yamalight
yamalight / README.md
Last active January 13, 2023 11:18
Feedly Colorful Listview
@ldong
ldong / DiffMerge_Change_font.md
Created September 30, 2015 21:31
Change Git: Change DiffMerge Font-Size on Mac OSX

Git: Change DiffMerge Font-Size on Mac OSX

open -e ~/Library/Preferences/SourceGear\ DiffMerge\ Preferences

Append this to it

[File]
Font=22:76:consolas
DSLContext database = Mockito.mock(DSLContext.class, Mockito.RETURNS_DEEP_STUBS);
Mockito.when(database.select(ACTIVITY_TYPE.ID)
.from(ACTIVITY_TYPE)
.where(ACTIVITY_TYPE.SINGLE_PERSON_USABLE.isTrue())
.fetch(ACTIVITY_TYPE.ID))
.thenReturn(ImmutableList.of(singleActivityTypeId));
Mockito.when(database.select(ACTIVITY_TYPE.ID)
.from(ACTIVITY_TYPE)
@inooid
inooid / .bash_profile
Created March 16, 2015 09:34
Google command to search on Google from the command line (Mac OS X)
# Command to open the webbrowser and immediately start searching
# for the right keyword.
#
# Usage:
# $ google test query
# $ => Opens the browser on http://www.google.com/search?q=test+query
#
google()
{
@rmorenobello
rmorenobello / setSystemPropertyFromCLI.groovy
Last active November 2, 2020 04:46
How to set and retrieve JVM system variables when running java/groovy from CLI
// http://stackoverflow.com/questions/8098564/is-it-possible-to-specify-java-system-properties-when-running-groovy-from-comman
/*
System properties are set on the java command line using the
java -Dpropertyname=value
syntax.
They can also be added at runtime using
System.setProperty(name, value)
or via the various
System.getProperties().load()
methods.