Skip to content

Instantly share code, notes, and snippets.

View mrkeuz's full-sized avatar

Mr Keuz mrkeuz

  • Russia, Saint-Petersburg
View GitHub Profile
@mrkeuz
mrkeuz / idletime.sh
Created April 18, 2016 23:34 — forked from Neil-Smithline/idletime.sh
Mac OS X Idle Time Shell Script
#!/bin/sh
# Get MacOSX idletime. Shamelessly stolen from http://bit.ly/yVhc5H
/usr/sbin/ioreg -c IOHIDSystem | /usr/bin/awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'
@mrkeuz
mrkeuz / homebrew-github-api-token.md
Created April 1, 2016 11:18 — forked from christopheranderton/homebrew-github-api-token.md
Set your Github API Token If you hit a ”GitHub API rate limit exceeded” when searching with Homebrew (http://brew.sh/).

Description

When using Homebrew (http://brew.sh) and searching formulas or pull requests you may get the dreaded error message: Github API Rate limit exceeded

Let's fix that! (yeah!)


Short version

Create a new Personal Token in your Github Account Settings (Sidebar: Applications) and then copy the Token. In the Terminal, use export HOMEBREW_GITHUB_API_TOKEN=YOURAPITOKENWITHFUNKYNUMBERSHERE (change that to your API Token) or add that to your .bash_profile and then do source .bash_profile.

@mrkeuz
mrkeuz / build.gradle
Created March 9, 2016 11:47
Gradle. Classpath. Newbie. Just for fun - FP style task for list classpath (for each configartion)
// Tested on gradle 2.11
task show {
configurations.each {
fileList ->
println fileList
fileList.each {
file ->
if (file == fileList.last()) {
print " +--- "
@mrkeuz
mrkeuz / start.ini
Created March 4, 2016 04:03
Docker hosted Jetty remote JMX recipe
# Docker hosted Jetty remote JMX recipe
#
# Tested on: jetty:9.3-jre8
# work with args: --module=jmx,jmx-remote
#
# IMPORTANT: Hostname parameter (java.rmi.server.hostname) important for search RMI server
# during connection (AFIAK) and must point to exposed, external <host:port>
# (see https://olegz.wordpress.com/2009/03/23/jmx-connectivity-through-the-firewall/)
#
-Djava.rmi.server.hostname={external IP/hostname}
@mrkeuz
mrkeuz / current-dir-in-iterm-tab-title.sh
Created February 26, 2016 20:15 — forked from phette23/current-dir-in-iterm-tab-title.sh
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html