Skip to content

Instantly share code, notes, and snippets.

@ryenus
ryenus / tmux-cheatsheet.markdown
Created November 20, 2018 20:51 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ryenus
ryenus / readlink_f.sh
Last active September 28, 2018 03:43
portable readlink_f implementation
: sd
#*TAG:39985 20:1973-09-17:0755:../d.proj-sd/sd
# Author: Brian Hiles <[email protected]>
# Date: 1998/11/20
# Description: sed debugger with conditional spypoints
# License: copyright (c) 1996-2002
# Name: sd
# Project: @(#)sd-standalone.sh 3.3 2001-04 [email protected] (Brian Hiles)
# Requires: echon(3S), expr(1), rm(1), sed(1)
# Thanks-to: Walter Briscoe <[email protected]> for AIX compatibility
@ryenus
ryenus / htop_with_mouse.sh
Last active June 16, 2018 09:27
build htop with mouse support on macOS
#!/bin/bash
# install ncurses if not yet
# [ -z "$(brew info ncurses | grep 'Not installed')" ] || \
brew install ncurses
# setup $LDFLAGS and $CPPFLAGS
# source <(brew info ncurses | grep 'FLAGS' | sed -r -e 's/: +/=/' -e 's/^ +/export /')
export LDFLAGS=-L/usr/local/opt/ncurses/lib
export CPPFLAGS=-I/usr/local/opt/ncurses/include
@ryenus
ryenus / CheckednessRemover.java
Last active May 21, 2018 09:03
java exception checkness remover
// http://johannesbrodwall.com/2018/05/15/a-wicked-java-trick-to-make-the-jvm-forget-to-check-exceptions/
// https://www.reddit.com/r/java/comments/8kz1tl/a_wicked_java_trick_to_make_the_jvm_forget_to/
// https://www.reddit.com/r/programming/comments/8kz1vf/a_wicked_java_trick_to_make_the_jvm_forget_to/
static RuntimeException softenException(Exception e) {
return checkednessRemover(e);
}
static <T extends Exception> T checkednessRemover(Exception e) throws T {
throw (T) e;
@ryenus
ryenus / brew_deps.sh
Created April 16, 2018 02:44
Homebrew: List packages and what uses them
# see https://www.thingy-ma-jig.co.uk/blog/22-09-2014/homebrew-list-packages-and-what-uses-them
brew list -1 | while read cask; do echo -ne "\x1B[1;34m $cask \x1B[0m"; brew uses $cask --installed | awk '{printf(" %s ", $0)}'; echo ""; done
@ryenus
ryenus / gist:cd755727bdd53e9b8b80b145b8ac235a
Created December 13, 2017 13:39 — forked from tonymtz/gist:714e73ccb79e21c4fc9c
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
#!/bin/sh
# to run this, use the following:
# curl https://matthewbauer.us/kernel-panic.sh | sh
cfile=$(mktemp).c
cat <<EOF >> $cfile
#include <unistd.h>
#include <sys/syscall.h>
#include <signal.h>
@ryenus
ryenus / bashrc
Created February 15, 2017 02:29 — forked from theBull/bashrc
How to change cursor shape, color, and blinkrate of Linux Console
##############
# pretty prompt and font colors
##############
# alter the default colors to make them a bit prettier
echo -en "\e]P0000000" #black
echo -en "\e]P1D75F5F" #darkred
echo -en "\e]P287AF5F" #darkgreen
echo -en "\e]P3D7AF87" #brown
echo -en "\e]P48787AF" #darkblue
@ryenus
ryenus / RestTemplateConfig.java
Created January 10, 2017 12:50 — forked from jonashackt/RestTemplateConfig.java
Spring RestTemplate with Support for Connecting to https with selfsigned Certificates (ApacheHTTPClient >= 4.4) and ByteArrays in Responses
import java.util.ArrayList;
import java.util.List;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.http.MediaType;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.web.client.RestTemplate;