Use this repository instead of your brain. Super helpful?
Host github1
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_github1
Host github2
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_github2
Then register additional ssh keys using ssh-add
ssh-add -t 12h ~/.ssh/your_private_key
List current keys using
ssh-add -l
The last step is to clone the git using the new virtual Host from the ssh config
git clone git@github1:username/projectname.git
#The ssh proxy machine
Host my-proxy-name
HostName <ip address>
User ec2-user
IdentityFile ~/.ssh/<identity>.pem
#Connect to a host matching a pattern
Host <partial-match-dns>-*.eu-west-1.compute.internal
User ec2-user
IdentityFile ~/.ssh/<identity>.pem
ProxyCommand ssh my-proxy-name -W %h:%p
#Connect to a specific host through a proxy machine running ssh
Host <some-other-host-trivial-name>
User ubuntu
IdentityFile ~/.ssh/spiideo-kp1.pem
ProxyCommand ssh my-proxy-name -W <some-specific-machine>.eu-west-1.compute.internal:22
- Download / install sshuttle
sshuttle --dns -r username@remote-server-ip-or-name 0/0
Tools for analyzing local networks
ip route get 8.8.8.8
iw dev wlan0 scan | grep "SSID:" | sort | uniq
List local ip addresses that were recently connected.
This is primarily run FROM a router, e.g. OpenWRT or other router that has a shell.
ip neigh
dns-sd -B _http
dns-sd -L "Instance name here" _http._tcp.
dns-sd -Gv4v6 bla-bla-bla.local
Scan all ports for a specific IP address
nmap -p- 192.168.1.2
TODO: Add more nmap examples
pbpaste | gpg -ear <recipient>
pbpaste | gpg -d
gpg --output encrypted_file.gpg --encrypt --recipient <recipient> file_to_encrypt
gpg --output decrypted_file --decrypt encrypted_file.gpg
gpg --sign -c file.txt
gpg --output <file> -d <file>.gpg
openssl aes-256-cbc -a -salt -in <INFILE> -out <OUTFILE>.openssl
openssl aes-256-cbc -d -a -in <INFILE>.openssl -out <OUTFILE>
- -a Means that the file (in/out) should be in Base64
- -d Means decrypt
# ssh -N -L [bind_address:]<local port>:<host>:<remote port> <server>
ssh -N -L 5005:localhost:4000 some.ssh.server.com
rustup update
rustup show
rustup toolchain list
rustup default nightly
rustup default stable
Display features enabled by a dependency
cargo tree -e features
List installed applications
cargo install --list
Install:
cargo install cargo-sweep
Removes build artifacts except for the currently installed toolchain
cargo sweep -r --toolchains="stable" "$HOME/repos/"
Sweep everything (except for binaries and a few other artifacts)
cargo sweep -r --maxsize 0 "$HOME/repos/"
Install:
cargo install cargo-update
List what needs to be updated:
cargo install-update -l
Update all packages
cargo install-update -a
Find unused dependencies.
https://github.com/est31/cargo-udeps
Use:
cargo +nightly udeps --all-features
cargo doc --no-deps --all-features --open
brew install go --cross-compile-common
A good use of gore might be to get current epoch nanos
$ gore
:import time
time.Now().UnixNano()
- Homebrew:
brew cask install adoptopenjdk11
- SDKMAN!
- List:
sdk list java
- Install:
sdk install java 13.0.1.hs-adpt
- List:
Use VisualVM
pkill -3 java
Stacktrace will end up in /var/log/<some name>.log
Use top
and press Shift+H to see thread PIDs, convert them to 0xHex and check against the log.
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n -jar <myapp>.jar
See SSH section for port forwarding from a remote server
Crontab for removing old sessions (if your inode count goes through the roof, and you can't use your system anymore...)
0 5 * * * find /var/lib/php5 -name "sess_*" -cmin +24 | xargs rm
Here's a post on stackoverflow for finding the place with the most files if you run out of inodes.
Check your inode count using
df -i
- https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/
- E.g. Jackson settings are explained under "Customize the Jackson ObjectMapper"
- https://spring.io/blog/2013/05/11/content-negotiation-using-spring-mvc
ErrorMvcAutoConfiguration
- Whitelabel error page configurationDefaultErrorAttributes
- this is (one of?) the place the map of error values are generatedErrorViewResolver
- implement this and install it as a Bean/Component to override the whitelabel error page.
docker images
docker ps
Or to show all containers
docker ps -a
-e
: supply environment variable-it
: interactive shell, if necessary--rm
: means temporary container, will be removed after exit-p
: map port fromHOST:CONTAINER
-d
: Detach - Run container in background and print container ID-v
: Mount a directory in the containerHOST:CONTAINER
--network
: Specify the network, usehost
for running the container in the host network space.- On mac the host can be connected to using DNS
docker.for.mac.localhost
- On mac the host can be connected to using DNS
Examples
docker run -it --network host --rm -v "$HOME/slask":/opt/slask ubuntu:17.10 bash
docker run -e SOME_ENV_VARIABLE='true' --rm -it -p 8080:8080 name/of/image:version
docker volume ls -qf dangling=true
docker volume rm $(docker volume ls -qf dangling=true)
An app for managing Docker images locally: Simple Docker UI
docker run --rm -it \
-v $(pwd):/config \
linuxserver/ffmpeg \
-f hls -i "<HLS_LINK_HERE>" -c copy /config/out.mp4
- Authenticate with a backend server (Google Sign in for Android)
brew install awscli
Then configure it (AWS CLI Getting Started)
export AWS_DEFAULT_PROFILE=user2
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
amazon:
#The live server location, if you want to run against it
region: EU_WEST_1
dynamoDb:
# If this is set, run against dynamo db local
endpoint: http://localhost:8000/
logging:
level:
com:
package: TRACE
pbpaste works by default on OSX, can work on linux if you define it.
A CLI for parsing JSON data into component parts, usable by your shell.
pbpaste | underscore print --color | less
pbpaste | python -m json.tool | less
Additional properties are given on the command line as
./gradlew task1 task2 task3 '-PmyPropertyName=some-value'
The properties can be used in gradle tasks/plugins/etc:
project.findProperty("myPropertyName")
./gradlew --no-daemon -Dorg.gradle.debug=true <task-name>
Then in IDEA create a "Remote" configuration on port 5005 and press debug.
./gradlew --refresh-dependencies dependencies
gradle wrapper --gradle-version 3.1
The following options can be put in a gradle.properties
file in the root of your Gradle project.
# Enable gradle daemon
org.gradle.daemon=true
# Enable caching
org.gradle.caching=true
# Set JVM args, e.g. increase heap or set OOM flags
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/bes/slask/heapdump
Configure the test heap
allprojects { project ->
project.plugins.withId('java') {
// Only for tests
test {
maxHeapSize = "1536M"
jvmArgs "-XX:MaxMetaspaceSize=512m"
}
}
project.plugins.withId('java-library') {
// Only for tests
test {
maxHeapSize = "1536M"
jvmArgs "-XX:MaxMetaspaceSize=512m"
}
}
}
Discovering Gradle build scripts from classpath (embed gradle scripts in gradle plugin) Distribute Custom Gradle (wrapper with scripts?) Provided scope in gradle, use provided scope without dependencies ending up in the distribution)
Installing on OSX
curl https://sdk.cloud.google.com | bash
Using a preview command
gcloud preview app deploy
Install kubectl gcloud components install kubectl
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=33777 -Dcom.sun.management.jmxremote.rmi.port=33777 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
Restart shell
exec -l $SHELL
Tables generated with Tables Generator
Cut / Paste in terminal (Readline Kill / Yank)
Keys | Command |
---|---|
C-k | Readline kill |
C-y | Readline yank |
More cutting
Keys | Command |
---|---|
Alt-d | Cut forward to end of word |
Ctrl-w | Cut backwards to beginning of word |
Ctrl-u | Cut backwards to beginning of line |
Ctrl-space | Set mark (start selecting) |
Ctrl-2 | Set mark (same as Ctrl-space) |
Alt-w | Cut marked area |
Ctrl-x-x | Start marking in opposite direction |
Search backwards / forwards
Keys | Command |
---|---|
C-r | Search backwards |
C-s | Search forwards |
Less commands
Keys | Command |
---|---|
Spacebar | Next page |
b | Previous page |
/ | Forward search |
? | Backward search |
n | Next search match |
N | Previous search match |
q | Quit |
git ls-files --modified | gxargs gsed -i '1{/^$/d}'
du -h -d1 | ggrep -E "[0-9]+\.?[0-9]*G"
(macOS, or linux without g prefix)
gfind -type f -exec gdu -Sh {} + | gsort -rh | head -n 5
My self-answered stackoverflow/superuser question
setopt xtrace
my_func
unsetopt xtrace
It's also possible to use (and combined with xtrace):
setopt verbose
my_func
unsetopt verbose
- OSX:
/usr/local/share/zsh/functions
~/.oh-my-zsh/plugins
Tell Git not to guess, but rather insist that you set user.name and user.email explicitly before it will let you commit:
git config --global --add user.useConfigOnly true
If the branch exists
git push <remotename> <commit SHA>:<remotebranchname>
If the branch does not yet exist
git push <remotename> <commit SHA>:refs/heads/<remotebranchname>
git worktree add -b hotfix ../hotfix origin/master
When you are done with a linked working tree you can simply delete it
rm -rf ../hotfix
Administrative files will get gc'd, but you can do that manually too:
git worktree prune
git remote prune origin
# Warning will remove all 'newly created' branches as well (removes all fully merged branches from the current branch's perspective)
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
git log --oneline --graph origin/master..HEAD
git tag -a <tagname> [<commit>]
git push <remote> --tags
git push <remote> HEAD:refs/for/branch-name
git branch -lvv
git log --patch | grep -E "(commit ([0-9]|[a-fA-F])+|((\+|\-).+(returnData)))" | less
In a specific file
git log --patch ./path/to/File.java | grep -E "(commit ([0-9]|[a-fA-F])+|((\+|\-).+(returnData)))" | less
git log -Gregex
#or
git log -Sword
Print the diff of each file matching the search:
git log -Sword -p
git branch --track topic_branch_name origin/rel-7.2.A.0
git branch -u upstream/foo
Copied from this article First add a remote
git remote add -f <remote name> <git path>
Then add the subtree
git subtree add --prefix <new path of subtree> <remote> master --squash
Update the subtree later
git fetch <remote> master
git subtree pull --prefix <path of subtree> <remote> master --squash
Contribute to upstream
git subtree push --prefix=<path of subtree> <remote> <TARGET-BRANCH>
- DB Browser for SQLite
- Sequel Pro
You need to install CMake first! Instruction for Linux/OSX:
- Clone GLFW from GitHub
cmake .
make install
Now you can #include <GLFW/glfw3.h>
#ImGui
Framework for menus / windows in OpenGL (e.g. using GLFW)
- Build, Execution, Deployment > Compiler > Annotation Processors > Enable annotation processing
- Plugins > Browse repositories > Lombok
- Add @ComponentScan annotation to your @SpringBootApplication, otherwise @Autowired can't be found by IntelliJ (?)
- GPG Mini Howto
- What default algorithm to use (See top answer) I use RSA / RSA.
adb logcat | grep SomeTerm | sed -e 's/\/SomeOtherTerm[(].....[)]//'
command > /dev/null 2>&1
command > >(tee ~/Desktop/buildlog/stdout.log) 2> >(tee ~/Desktop/buildlog/stderr.log >&2)
- Find model files, download recovery & CM SW
- Go to device Wiki & follow instructions
adb shell
run-as com.your.packagename
cd /data/data/com.your.pacakagename/
See this answer on stackoverflow
Use Lombok + Android APT
Check for resources inside APK
~/sdk/android-curr/build-tools/21.1.1/aapt dump resources build/outputs/apk/MyApk.apk | grep raw/
adb shell pm list packages -f
aapt d badging <APK>
adb shell monkey -s 20120614 -v -p com.package.name -p com.package2.name --pct-touch 20 --pct-motion 60 --pct-majornav 15 --pct-appswitch 5 --throttle 300 1000000 | tee log.txt
~/sdk/android-curr/platform-tools/systrace/systrace.py --app=com.package.name gfx input view wm am hal res dalvik sched freq idle load
$ adb shell dumpsys meminfo com.package.name
or
adb shell procrank | grep home
- https://developer.android.com/tools/debugging/debugging-memory.html
- Proportional Set Size (PSS) = Unique pages + Fraction of Shared pages
- Private (Clean and Dirty) RAM
- Private dirty ram = Used only by your process, only exists in RAM
Result of operation (e.g. encrypted content) is output to FD 0 (stdout) = shown in terminal.
$ adb shell bu 0 backup <package name>
More options are available in frameworks/base/cmds/bu/src/com/android/commands/bu/Backup.java
$ tcpdump -i <interface> -s 65535 -w <some-file>
$ tcpdump -i any -p -s 0 -w /sdcard/capture.pcap
# "-i any": listen on any network interface
# "-p": disable promiscuous mode (doesn't work anyway)
# "-s 0": capture the entire packet
# "-w": write packets to a file (rather than printing to stdout)
Only for loopback:
$ adb shell "tcpdump -i lo -vv -s 0 -w /sdcard/tcpoutput.pcap"
DPI Scale factors
- LDPI = 0.75
- MDPI = 1
- TVDPI = 1.33
- HDPI = 1.5
- XHDPI = 2
- XXHDPI = 3
$ adb shell getprop ro.sf.lcd_density
$ adb shell dumpsys window | grep DisplayWidth
Ex. HVGA
$ adb shell wm size 320x480
$ adb shell wm density 160
Ex. Tablet
$ adb shell wm size 1080x1920
$ adb shell wm density 240
Tip: kill com.android.systemui from DDMS to force it to load the correct resources.
$ adb shell setprop log.tag.SQLiteLog V
$ adb shell setprop log.tag.SQLiteStatements V
$ adb shell stop
$ adb shell start
emulator -avd <some avd> -netdelay 400:1200 -netspeed gsm
Note from the manual:
Operators
Operators join together the other items within the expression.
They include for example -o (meaning logical OR)
and -a (meaning logical AND).
Where an operator is missing, -a is assumed.
gfind . -type d \
\( \
-path ./node_modules \
-o -path ./.git \
\) \
-prune \
-o -type f -name "*.ts*" -print | gxargs wc -l
So logically this means
- Find from
.
all -type d- And from that list if the path is
- node_modiles
- OR .git
- Then -prune the list of those directories
- And from that list if the path is
- After pruning
sudo visudo
# Find this line
Defaults env_reset
# Change to this line
Defaults env_reset,pwfeedback
# Now timeout your sudo session and test it
sudo -k
# Should prompt your password again
sudo visudo
RANDOM_STRING=$(env LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 64 | head -n 1)
Poll status of running dd, (status will be printed in the terminal running dd).
sudo dd if=/dev/urandom of=./bigfile bs=1M count=458000
#check status
sudo kill -USR1 `pidof dd`
sudo dd if=/dev/urandom of=./bigfile bs=1m count=458000
#check status
sudo kill -INFO `pidof dd`
for f in $(find -name "*.apk"); do adb install -r $f; done
Use dos2unix command in ubuntu
lsof
Or on macos you can also use
sudo fs_usage
dig +short myip.opendns.com @resolver1.opendns.com
Use the memusg script, as explained here.
# While developing
jekyll serve
# Before launching
jekyll build
First try to find the memory address of the instance you want to inspect. That can be done with e.g. the memory graph in XCode.
Then, in the LLDB prompt:
(lldb) expr -l Swift -- let $my = unsafeBitCast(0x98f63c31, to: MyClass.self)
(lldb) expr -l Swift -- print($my.thing)
xcrun simctl list devices
#or
xcrun simctl list devices | grep Booted
- Archives - Delete from Organizer
- Simulators - Delete from XCode then
xcrun simctl delete unavailable
- Device debug symbols - Delete unwanted from
~/Library/Developer/Xcode/iOS DeviceSupport/
~/Library/Developer/CoreSimulator/Devices/<DEVICE_ID_FROM_SIMCTL>/
-
Queue types
-
Custom Serial Queue
-
Global Concurrent Queue
-
Custom Concurrent Queue
-
Concurrent queues
-
QOS_CLASS_USER_INTERACTIVE: UI updates, small workloads
-
QOS_CLASS_USER_INITIATED: Waiting for immediate result, required for continued user interaction
-
QOS_CLASS_UTILITY: Long running tasks with progress
-
QOS_CLASS_BACKGROUND: User is unaware
-
Methods
-
dispatch_get_main_queue
-
dispatch_get_global_queue
-
dispatch_queue_create: instantiate with reverse DNS style name
-
DISPATCH_QUEUE_CONCURRENT
-
DISPATCH_QUEUE_SERIAL (or) nil / NULL / 0: Serial queue
-
dispatch_queue_attr_make_with_qos_class: Usage = private let serialQueue = dispatch_queue_create("my.reverse.dns", dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_BACKGROUND, 0))
-
dispatch_after
-
dispatch_sync:
-
dispatch_async
-
dispatch_barrier_async
-
Dispatch barrier (dispatch_barrier_async) advice
-
Custom Serial Queue: Don't use dispatch barrier, doesn't make sense
-
Global Concurrent Queue: Be careful, can starve other global tasks
-
Custom Concurrent Queue: Do use
brew cask install miniconda
I have put a custom conda plugin in .oh-my-zsh
#Check which sandboxes you already have
conda info -e
#Create a new sandbox
conda create -n my_sandbox python=3.6
#Use the sandbox in this terminal
source activate my_sandbox
#iPython is probably useful
conda install ipython
#When you feel done use
source deactivate
$ ipython
from webmonkey import monkey
mon = monkey.SW()
mon.driver...
JSON.stringify is great but sometimes complex node objects have recursive pointers.
Use this instead:
const util = require('util')
console.log(util.inspect(myObject, {showHidden: false, depth: null}))
Or just use console.log
or console.dir
which use it implicitly.
Example: Node 7.10 and NPM 5.0.1
nvm install 7.10
nvm use 7.10
npm install -g [email protected]
pixelRatio(canvas) {
var ctx = canvas.getContext("2d"),
dpr = window.devicePixelRatio || 1,
bsr = ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1;
return dpr / bsr;
}
prepareCanvas(canvas, width, height) {
var pixelRatio = this.pixelRatio(canvas);
canvas.width = width * pixelRatio;
canvas.height = height * pixelRatio;
canvas.style.width = width + "px";
canvas.style.height = height + "px";
return pixelRatio;
}
Vagrant is an easy way to set up virtual machines. Don't forget to install VirtualBox.
Place this file in ~/vagrant/Vagrantfile
To start the machine in go to the directory with the Vagrantfile and do
vagrant up
To enter the machine do
vagrant ssh
#Save the current state and stop
vagrant suspend
#Shut down the OS and power down the guest machine
vagrant halt
#Completely remove the machine from the host
vagrant destroy
#Upgrade e.g. ubuntu
vagrant box update
nmap -sn 192.168.1.0/24
Keyboard repeat rate - sign out required?
defaults write -g KeyRepeat -float 1.8
defaults write -g InitialKeyRepeat -int 15
Dock animation speed
defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
Show hidden files
defaults write com.apple.finder AppleShowAllFiles YES;killall Finder
Key repeat not working in some apps, reboot needed:
defaults write -g ApplePressAndHoldEnabled -bool false
Set the screenshot directory
defaults write com.apple.screencapture location /Users/myuser/some/path
Turn off charging hardware chime
defaults write com.apple.PowerChime ChimeOnNoHardware -bool true
killall PowerChime
Kernel modules can be located in these locations
- User kexts
/Library/Extensions
- System kexts
/System/Library/Extensions
kextstat
sudo kextunload /Library/Extensions/SomeKernelExtension.kext
sudo rm -rf /Library/Extensions/SomeKernelExtension.kext
Also check if there are things hanging around in Receipts
# Remove any Receipts that belong to a .kext
lsa -lsa /Library/Receipts/
Follow this guide on Lifehacker. Or from the original source.
But use the modified version below to avoid the Automator Cog, which shows up unless you redirect the log to /dev/null
.
Basically:
- Create a folder somewhere, e.g. in home folder called
~/.dropbox2
- In Automator
- File > New > Application option
- Drag the "Run Shell Script" action into the main window
- Paste this
HOME=$HOME/.dropbox2 /Applications/Dropbox.app/Contents/MacOS/Dropbox &>/dev/null &
- When the disk is attached, run the program - Before the disk is detached, close Dropbox2 (exit the second dropbox instance).
pmset -g assertions
- Environment variables for non-terminal using plist?
- Not working since Yosemite? Environment variables (not in .bashrc)
#These won't end up in your terminal PATH
defaults write ~/.MacOSX/environment PATH "/all/your/paths/:/paths/"
sudo lsof -i :8080
##Improve performance MacOS X (on mid 2014 rMBP) has pretty bad performance on an external 4k display. These tips might help:
- Global shortcut for dark/light mode Control+Option+Command+T.
- iTerm jump and end of line
pbcopy < ~/.ssh/id_rsa.pub
- Homebrew - brew for short.
- Homebrew FAQ
- iTerm2 (version 3)
- Zsh / brew
- Oh-My-Zsh GitHub, http://ohmyz.sh/, Themes
- Git - install using brew (see further instructions below)
- Kdiff3 For git-mergetool (Set-up)
- git config --global merge.tool kdiff3 http://stackoverflow.com/questions/9776434/git-mergetool-config-on-mac-osx
- Retina gitk
- Retinizer - Make non-retina apps into retina apps (e.g. Gitk)
- brew cask install retinizer
- open /System/Library/Frameworks/Tk.framework/Versions/Current/Resources/
- Drag Wish and drop into Retinizer
- KeeWeb (Native Electron-based KeePass2 app for MacOS)
- Hyperswitch Command+Tab replacement
- Smooth Mouse for turning off mouse acceleration - Does not work for Sierra :/
- Karabiner for increasing repeat rate and decreasing repeat wait timer
- Atom Competent text editor by Github
- Sublime Text
- SizeUp by IrradiatedSoftware (maximize / center / snapback windows)
- iStat Menus Some useful status bar menus (CPU, Network, Calendar)
- XCode
- RVM Run multiple Ruby versions simultaneously.
- Finderpath (Command+G path in finder)
- TLDR man pages:
brew tap tldr-pages/tldr && brew install tldr
- XnViewMP image viewer / editor
- CyberDuck FTP Client
- Soundflower advanced sound input/output adjustment [This fork seems best right now](https://github .com/mLupine/SoundflowerBed/releases)
- VeraCrypt If you need that sort of thing
- OSX Fuse Needed by VeraCrypt
- GPGTools
- Ukelele Keyboard Layout Editor
- qBittorrent
- Chat apps (Gtalk)
- Adium (Free, uglier than Flamingo but has better notifications)
- Livestreamer (pip install livestreamer // livestreamer )
- FFMPEG
brew install ffmpeg --with-openssl --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
- Tunnelblick OpenVPN Client
SDK Manager for Java based languages https://sdkman.io/.
First install brew bundle by simply writing brew bundle
in the terminal, which is also the command for
installing everything in the bundle file in the current directory.
Create a Homebrew bundle in the form of a Brewfile
,
which declares all taps and packages that you have installed.
Create a Brewfile
from scratch in the current directory:
brew bundle dump --file ./Brewfile --force
To uninstall all Homebrew formulae not listed in Brewfile:
brew bundle cleanup
brew list
brew update
brew outdated
brew upgrade <pkg>
brew upgrade
This command is very useful because a lot of space can be wasted on unused versions
brew cleanup
Install with brew install
- awscli
- bmon - (network monitoring)
- curl
- findutils - (GNU findutils gfind, gxargs, ...)
- gradle
- [grep] - (ggrep)
- groovy - (Groovy programming language)
- moreutils (contains ts for prepending datetime to terminal lines)
- nmap - (Network mapper)
- node - (NodeJS)
- openssl
- pidof - (find PIDs of named program)
- swiftlint - (XCode swift linting)
- tree
- unrar
- wget
- zsh
- OpenJDK
brew tap AdoptOpenJDK/openjdk
thenbrew cask install adoptopenjdk11
- AdoptOpenJDK
Install:
brew install git
Or if you want to use git with git-extras you should probably use
brew install git --without-completions
According to README.md in ~/.oh-my-zsh/plugins/git-extras
:
On OS X with Homebrew, you need to install git
with brew install git --without-completions
. Otherwise, git
's _git
will take precedence, and you won't see the completions for git-extras
commands.
Then install git-extras itself via brew install git-extras
brew install bmon
- Re-map Command/Option key on Windows USB keyboard) (Instead of losing your mind)
- Word/Line deletion in iTerm2
If you installed git from git-scm.org according to the instructions, you need to symlink /usr/bin/git to /usr/local/git/bin/git otherwise intellij can't find git in exec().
- JEnv Set Java Home, locally for a given path if you want.
Example with Atlassian SourceTree
open -a SourceTree <path/to/repository>
Example: QuickTime Player
cd /Applications/QuickTime Player.app/Contents/MacOS%
./QuickTime\ Player
Same as Unix/Linux
lsof
- Turn on computer
- When the mac sound plays press
⌘ + R
- Enter disk utility and mount the disk (if it is encrypted it is not auto mounted)
- Exit disk utility, enter Terminal via menu bar
- In terminal write diskutil
secureErase freespace 4 /Volumes/Macintosh\ HD
- If your disk is named something else you need to adapt the command
% brew list
autoconf gawk libffi mtr socat
automake gdbm libgpg-error nmap sqlite
awscli gettext libksba node stress
bash git libogg openssl swiftlint
bmon glib libpng openvpn tcl-tk
cairo gmp libquvi opus texi2html
cmake gnu-sed libtool pcre tldr
confuse gobject-introspection libvo-aacenc pidof tree
curl gradle libvorbis pixman unrar
dos2unix grep libyaml pkg-config wget
faac groovy libzip protobuf x264
fdk-aac harfbuzz lua protobuf-swift xvid
findutils icdiff lzo python3 xz
fontconfig icu4c maven qt yasm
freetype lame mpfr readline zeromq
fribidi libass mplayer sdl zsh
This command edits the sudoers file:
sudo visudo
Here is an explanation on askubuntu.
Another way of doing it is adding only your own user as a sudoer:
myusername ALL=(ALL:ALL) NOPASSWD:ALL
Used to select what java versions are used, on Ubuntu Linux (probably other dists as well)
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config jar
$ update-java-alternatives -l
Gnome HiDPI info on Archlinux wiki.
Basically you first scale up to 2x2 (X only supports integer scaling, Wayland probably will handle floats):
gsettings set org.gnome.desktop.interface scaling-factor 2
# There is a UI setting for this in Gnome, but I didn't feel it went "all the way":
Gnome Tweak Tool -> Windows -> HiDPI -> Window scaling = 2
Now you can "Zoom Out":
# Fetch display name
xrandr | grep -v disconnected | grep connected | cut -d' ' -f1
# Zoom out
xrandr --output <DISPLAY NAME FROM PREVIOUS COMMAND> --scale 1.2x1.2
If you are having problems with e.g. mouse: See archlinux wiki above.
Example configuration files here
Configuration in /etc/openvpn/
. Client config in .ovpn files.
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o <DEVICE e.g. eth0 but probably something else> -j MASQUERADE
And clear the rule when done
sudo iptables -t nat -F
Update local name.ovpn
file with the current correct external IP of the VPN server.
"server" in the command is the name of the configuration file
sudo systemctl start openvpn@server
Restart
sudo systemctl restart openvpn@server
-
Here is a guide from Digitalocean.
-
And here is another guide from the Ubuntu 14.04 help section
- VirtualBox
- Latest VirtualBox as package on Ubuntu 12.04
- Resize virtualbox
- Method 1
- Method 2:
$ vboxmanage createhd --size 40960 --variant Fixed --filename new.vdi
$ vboxmanage clonehd old.vdi new.vdi –existing
Then, inside windows: extend partition.
Or, [for dynamic size disks](https://brainwreckedtech.wordpress.com/2012/01/08/howto-convert-vdis-between-fixed-sized-and-dynamic-in-virtualbox/)
$ vboxmanage modifyhd [VDI] --resize [megabytes]
Then, inside windows: extend partition.
- Chrome
- Latest Chrome as package
- Chromium policy settings
- In chrome browser:
chrome://policy/
to check policies - Theming
- Manually fix any theme Tooltip background color Eclipse
- Or just use Clearlooks for GTK3
- Java 7 Sun
- System settings
- Use /etc/environment for "global" variables
- Gnome
- Create links using the app "alacarte"
- Doesn't work out-of-the-box, see: http://askubuntu.com/questions/160462/why-does-alacarte-give-me-this-error-when-i-try-to-add-items-to-the-menu You need to install the package gnome-panel.
- Ubuntu 12.04
- Calendar widget with week numbers http://askubuntu.com/questions/114032/ubuntu-application-to-show-calendar-with-week-numbers
- Gnome
- Use > Window List Extension, traytop extension (not so important: Native Window Placement Extension, overview-icon Extension)
- Gnome 3 keyboard shortcuts: dconf-editor guide: http://askubuntu.com/questions/135425/keyboard-shortcuts-dont-work-in-gnome-shell
- Gnome 3 TrayTop gnome extensions github (use with blink in pidgin + don't always show icon in tray)
- Gnome 3 Overlay icons github
- Gnome 3 WindowList github
- Gnome 3 Shell Extension dir ~/.local/share/gnome-shell/extensions/[email protected]
- Install Gnome 3 on 12.04
- How to set location bar in nautilus as default
- Compiz forgets your settings (keyboard shortcuts, change preferences to "Flat file"
- Scrollbars http://www.linuxbsdos.com/2012/04/27/whats-the-point-of-having-2-scrollbar-types-in-ubuntu-12-04/ and http://ubuntuforums.org/showthread.php?t=1949608
- Show date in clock widget http://forums.fedoraforum.org/showthread.php?t=261961
- Handbrake http://askubuntu.com/questions/107915/how-do-i-download-and-install-handbrake
- "GCD and dispatch_queue_t are still a masterpiece and the API works great in Swift"
- "Do you ever have the feeling that computer architectures come and go, but CA:AQA is forever?"
- Blue team rust
- Code and bitters
- Lifetime variance
- AWK in 20 minutes
- Futures Explained
- ELF format blog series by fasterthanlime
- Cryptopals: Learn stuff about crypto by doing excercises
- Google Machine Learning Crash Course
- Kill Math: Intuition guided math solving
- Azeria ARM (exploitation) tutorials
- AI Matrix Calculus
- Rust error handling
- Rust Type and Lifetime misconceptions
- Deep learning Matrix Calculus
- Build an 8-bit computer from scratch
- Computer Science from the bottom up
- Rust: Interior Mutability Patterns
- Rust: Undrastanding Rust Through AVL Trees
- Rust: YouTube: Async-Await Steve Klabnik
- Rust: Dtolnay docs
- Rust: Zero sized references
- Rust: Taking ML to production with Rust
- GCP: Authenticating to gke without gcloud
- Rust: Inviting God's Wrath with Cursed Rust
- Experimental WebGPU in Firefox
- Rust: Concurrency - Five easy pieces
- Terminal: Changing text and background color
- Rust: Involved lifetime example + solutions