Skip to content

Instantly share code, notes, and snippets.

kevinxw / state_based_entity_control.yaml
Last active Aug 4, 2021
State based Entity Control
View state_based_entity_control.yaml
name: State Based Entity Control
description: Change the target entity to desired entity state base on the trigger entity's state, illuminance sensor's state, Sun elevation and so on.
domain: automation
name: Trigger Entity
description: This entity will trigger the automation.
kevinxw /
Created Jun 25, 2019
seafile-sqlite to mysql
echo "Dropping database.."
mysql -e 'drop database if exists `seafile-ccnet`;'
mysql -e 'drop database if exists `seafile-main`;'
mysql -e 'drop database if exists `seafile-seahub`;'
echo 'Recreating ccnet database..'
mysql -e 'create database `seafile-ccnet` character set = "utf8";'
mysql 'seafile-ccnet' < seafile-server-latest/sql/mysql/ccnet.sql
echo 'Recreating seafile database..'
kevinxw /
Created Nov 9, 2017 — forked from vincent-zurczak/
A Maven mojo that shows how to resolve dependencies locations, be it in remote or in the local repository, or even in the reactor.
package whatever;
import java.util.ArrayList;
import java.util.HashSet;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
kevinxw / The Technical Interview Cheat
Created May 24, 2017 — forked from tsiege/The Technical Interview Cheat
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
kevinxw / ddns-start
Last active Aug 18, 2022
View ddns-start
# register a subdomain at to get your token
# put 'hostname|token' in the 'Host Name' field under DDNS
# e.g. myhost|abcdefgh-1234-5678-9876-f71b0ed7a7fe
DDNS_HOSTNAME_FIELD=$(nvram get ddns_hostname_x)
SUBDOMAIN=$(echo "$DDNS_HOSTNAME_FIELD" | awk -F'|' '{print $1}')
TOKEN=$(echo "$DDNS_HOSTNAME_FIELD" | awk -F'|' '{print $2}')
IPV4=$(nvram get wan0_ipaddr)
kevinxw /
Created Aug 30, 2016 — forked from the-darkvoid/
AsusWRT Merlin: Isolate Guest WiFi
kevinxw / .gitconfig
Last active Sep 12, 2016
ODL environment setup
View .gitconfig
default = simple
ci = commit
co = checkout
cp = cherry-pick
st = status
ps = push
pl = pull
br = branch
View karabiner-private.xml
<?xml version="1.0"?>
kevinxw /
Created Mar 3, 2015
OpenDaylight DHCP and DNS packet parser
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.controller.sal.packet.BitBufferHelper;
import org.opendaylight.controller.sal.packet.BufferException;
import org.opendaylight.controller.sal.packet.Packet;
import org.opendaylight.controller.sal.packet.PacketException;
import org.opendaylight.controller.sal.utils.HexEncode;
import org.opendaylight.controller.sal.utils.NetUtils;