Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
kevinhooke / gist:5dd81ea1412f485d8d2441219b72c604
Created Jul 27, 2018
Initialize a standalone Spring app with a @configuration bean AppConfig
View gist:5dd81ea1412f485d8d2441219b72c604
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(AppConfig.class);
ctx.refresh();
@54chi
54chi / Making it work for Mac OS.md
Last active Jul 15, 2021
LG UltraWide settings
View Making it work for Mac OS.md

How to create a 1280x1080 (among others) scaled resolutions for your non-standard monitor

Ultrawide monitors with PBP (Picture by Picture) are becoming more common these days. It allows you to split the screen and connect multiple sources to your monitor (e.g. 2 computers at the same time)

The problem is that the resolution is typically not supported out of the box (E.g. a 2560x1080 monitor, when split into 2 will require a 1280x1080 resolution, which is not standard in Mac OS as of Sierra)

Creating custom resolutions

First, we have to reboot in rootless mode, and disable the Integrity Protection, so we can create/override the screen file settings:

View create-or-update-stack.sh
#!/usr/bin/env bash
usage="Usage: $(basename "$0") region stack-name [aws-cli-opts]
where:
region - the AWS region
stack-name - the stack name
aws-cli-opts - extra options passed directly to create-stack/update-stack
"
@ankurk91
ankurk91 / bash_profile.md
Last active Apr 14, 2021
:octocat: Git branch name in Linux/Mac Bash Terminal
View bash_profile.md

Mac OS : Show your git branch name on your bash terminal

⚠️ Does not work in zsh terminal

Add these lines in your ~/.bash_profile file

# Show current git branch name
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@v-cphillipson
v-cphillipson / RedisCacheStatisticsProvider.java
Created Apr 18, 2016
Naive cache statistics provider implementation for Redis
View RedisCacheStatisticsProvider.java
import org.springframework.boot.actuate.cache.CacheStatistics;
import org.springframework.boot.actuate.cache.CacheStatisticsProvider;
import org.springframework.boot.actuate.cache.DefaultCacheStatistics;
import org.springframework.cache.CacheManager;
import org.springframework.data.redis.cache.RedisCache;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisConnectionUtils;
import java.util.Properties;
@aallan
aallan / speedtest-ifttt.sh
Last active Jun 25, 2021
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
View speedtest-ifttt.sh
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)
@kyungw00k
kyungw00k / install_rabbitmq_on_rhel5.sh
Created Jun 18, 2013
Install RabbitMQ on RHEL/CentOS 5
View install_rabbitmq_on_rhel5.sh
#!/bin/sh
#
# Install RabbitMQ on RHEL/CentOS 5
#
# Enable EPEL
wget -O /tmp/epel-release-5-4.noarch.rpm http://ftp.riken.jp/Linux/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -ivh /tmp/epel-release-5-4.noarch.rpm