Skip to content

Instantly share code, notes, and snippets.

@huangxiangdan
huangxiangdan / check_mysql.rb
Created April 26, 2012 01:19
a ejabberd extauth script
#!/usr/bin/env ruby
class NeterDbAuthorization
def initialize(config_file = 'config.yml')
# load config
require 'yaml'
@cfg = YAML.load_file(config_file)
# load logger
if @cfg['log']['file']
require 'logger'
@Admicos
Admicos / config.yml
Last active November 18, 2018 05:05
Join Python receiver thingy
port: 1818
commands:
# Join Push Text : Command to run
"eg=:=shutdown": "systemctl poweroff"
#fallback-cmd: "./fallbacktest.sh"
http://rootzwiki.com/topic/41985-enable-wifi-tether-through-adb/
adb shell input keyevent 3 # home
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.Settings
adb shell input keyevent 20 # down
adb shell input keyevent 20 # down
@michaelneu
michaelneu / xtend11.sh
Created June 27, 2014 20:32
Use Raspberry Pi as external network-monitor
#!/bin/bash
PI_IP="xxx.xxx.xxx.xxx"
LEFT_OF="VGA1" #"LVDS1"
CLIENT_SCRIPT_NAME="x11-client.sh"
LOCKFILE="/tmp/x11-extended-display-lock.pid"
screen_res='python -c "import Tkinter; r = Tkinter.Tk(); print r.winfo_screenwidth(), r.winfo_screenheight(); r.destroy();"'
d=`ssh pi@$PI_IP "export DISPLAY=:0 && $screen_res"`
case $1 in
@DarrolMusambani
DarrolMusambani / README.md
Last active February 2, 2022 08:15
Get Unifi-device information

A convenient Subflow to retrieve device informations from your unifi controller using node-red-contrib-unifi-os nodes with some humble error handling.

@freshjones
freshjones / gist:b0713263033df8cc9f44
Created February 5, 2015 23:18
bash script to monitor and do something with docker events
#!/bin/sh
docker events --filter 'event=start' --filter 'event=stop' | while read event
do
container_id=`echo $event | sed 's/.*Z\ \(.*\):\ .*/\1/'`
echo $container_id

TMUX - Single window group, multiple session.

So I have been using tmux for a while and have grown to like it and have since added many many customizations to it. Now once you start getting the hang of it, you'll naturally want to do more with the tool.

Now tmux has a concept of window-group and session and if you are like me you'll want multiple session that connects to the same window group instead of a new window group every time. Basically I just need different views into the same set of windows that I have already created, I don't want to create a new set of windows every time I fire up my terminal.

This is the default case if you simply use the tmux command as your login shell, effectively creating a new group of windows every time you start tmux.

This is less than ideal because, if you are like me, you fire up one-off terminals all the time and you don't want all those one-off jobs to stay running in the background. Plus sometimes you need information fro

@technoweenie
technoweenie / gist:1072829
Created July 8, 2011 21:12
.netrc file so you can push/pull to https git repos without entering your creds all the time
machine github.com
login technoweenie
password SECRET
machine api.github.com
login technoweenie
password SECRET
@HNJAMeindersma
HNJAMeindersma / X-USB PulseAudio.md
Created March 22, 2020 14:38
[Behringer X32 / Midas M32] Split a multi-channel X-USB into virtual outputs with PulseAudio on Linux/Ubuntu

X32/M32 with X-USB on Linux/Ubuntu

This guide is written for all owners of a Behringer X32 or Midas M32 with a X-USB 32x32 channel expansion card. It is directed towards splitting the X-USB channels up in virtual outputs on Ubuntu 18.04 with PulseAudio. The guide may also work for other versions or distro's of Linux with PulseAudio.

It is assumed that the X-USB is installed and connected to a computer. And automatically recognized as a multi-channel soundcard by the operating system. Also note that on Ubuntu 18.04, PulseAudio runs on top of ALSA. ALSA picks up the soundcard and PulseAudio then uses the full soundcard through ALSA to create virtual channels.

Table of contents

  1. Find X-USB device name
  2. Create virtual outputs in PulseAudio
  3. Restart PulseAudio
  4. Control application channel
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);