Skip to content

Instantly share code, notes, and snippets.

View anoochit's full-sized avatar

Anuchit Chalothorn anoochit

View GitHub Profile
@PomepuyN
PomepuyN / Watch face Ambient mode detection
Last active November 5, 2018 23:07
Allow to detect Ambient mode to switch Watch face display on Wear devices
Handler handler = new Handler(Looper.getMainLooper());
final DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
displayManager.registerDisplayListener(new DisplayManager.DisplayListener() {
@Override
public void onDisplayAdded(int displayId) {
}
@Override
@h4cc
h4cc / rsyslog_openvz_fix.sh
Created November 5, 2013 21:54
Using rsyslog on OpenVZ like Proxmox can lead to a problem, which symtoms are mostly >= 100% CPU usage of rsyslogd. Error message is "Cannot read proc file system: 1 - Operation not permitted.", because the file /proc/kmsg could not be read.
sed -i -e 's/^\$ModLoad imklog/#\$ModLoad imklog/g' /etc/rsyslog.conf
service rsyslog restart
# Source: https://github.com/devananda/openvz-tools/blob/master/install-openvz-kernel.sh