Skip to content

Instantly share code, notes, and snippets.

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

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:

#!/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 October 22, 2023 12:16
:octocat: Git branch name in Linux/Mac Bash Terminal

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 April 18, 2016 15:50
Naive cache statistics provider implementation for Redis
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 May 29, 2022 15:50
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
#!/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 June 18, 2013 06:52
Install RabbitMQ on RHEL/CentOS 5
#!/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