Skip to content

Instantly share code, notes, and snippets.

View qtopie's full-sized avatar

qtopie qtopie

  • GuangZhou, China
View GitHub Profile
@qtopie
qtopie / App.java
Last active May 17, 2018 14:55
Handling Plurals in java (i18n) sample code. Reference: https://docs.oracle.com/javase/tutorial/i18n/format/choiceFormat.html
import java.io.IOException;
import java.text.ChoiceFormat;
import java.text.Format;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.ResourceBundle;
public class App {
@qtopie
qtopie / playsound.sh
Last active April 2, 2018 07:34
Play Sound script for raspberry pi connected to XiaoMi bluetooth Echo (using a2dp with pulseaudio)
#!/bin/bash
# Usage:
# bash playsound.sh <AUDIO-FILE>
BLUEZ_MAC='74:A3:4A:0F:AB:D3'
get_a2dp_sink_index(){
index=$(pactl list sinks short | grep ${BLUEZ_MAC//:/_}.a2dp_sink | awk '{print $1}')
echo $index
@qtopie
qtopie / ssh-multi.sh
Last active August 9, 2017 16:18 — forked from dmytro/ssh-multi.sh
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
HOSTS=
read_host() {