Skip to content

Instantly share code, notes, and snippets.

@kevinxw
kevinxw / state_based_entity_control.yaml
Last active Aug 4, 2021
State based Entity Control
View state_based_entity_control.yaml
blueprint:
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
input:
trigger_entity:
name: Trigger Entity
description: This entity will trigger the automation.
selector:
entity:
@kevinxw
kevinxw / google.plus.pinterest.user.js
Last active Jul 11, 2021
Google+ Pinterest for the new UI
View google.plus.pinterest.user.js
// ==UserScript==
// @name Google+ Pinterest for the New UI
// @version 0.9
// @id google_plus_ui_sucks_pinterest_pokerface
// @namespace in.co.tossing.toolkit.google
// @downloadURL https://userscripts.org/scripts/source/130955.user.js
// @updateURL https://userscripts.org/scripts/source/130955.meta.js
// @run-at document-end
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
@kevinxw
kevinxw / ddns-start
Last active Jun 28, 2021
Asus-Merlin-DuckDNS
View ddns-start
#!/bin/sh
# register a subdomain at https://www.duckdns.org/ 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
kevinxw / The Technical Interview Cheat Sheet.md
Created May 24, 2017 — forked from TSiege/The Technical Interview Cheat Sheet.md
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 Sheet.md

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.
View straight.google.user.js
// ==UserScript==
// @name Straight Google
// @id straight_google_pokerface
// @version 1.17.13
// @author Pokerface - Kevin
// @namespace in.co.tossing.toolkit.google
// @description Remove URL redirection from google products
// @license GPL v3 or later version
// @downloadURL https://userscripts.org/scripts/source/121261.user.js
// @updateURL https://userscripts.org/scripts/source/121261.meta.js
@kevinxw
kevinxw / _README.md
Created Aug 30, 2016 — forked from the-darkvoid/_README.md
AsusWRT Merlin: Isolate Guest WiFi
View _README.md
@kevinxw
kevinxw / migrate.sh
Created Jun 25, 2019
seafile-sqlite to mysql
View migrate.sh
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
kevinxw / Crypto-lab6-digt.c
Last active Oct 12, 2018
CIS 644 Lab 6 Hash function crack
View Crypto-lab6-digt.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/evp.h>
void getHash(char * hashname, char *msg, unsigned char *md_value) {
EVP_MD_CTX *mdctx;
const EVP_MD *md;
//unsigned char md_value[EVP_MAX_MD_SIZE];
int md_len, i;
View adblock-generator.sh
#!bin/bash
SUBSCRIPTION_LIST=(
https://easylist-downloads.adblockplus.org/easyprivacy.txt
https://easylist-downloads.adblockplus.org/easylistchina.txt
https://easylist-downloads.adblockplus.org/easylist.txt
https://easylist-downloads.adblockplus.org/malwaredomains_full.txt
https://easylist-downloads.adblockplus.org/exceptionrules.txt
)
@kevinxw
kevinxw / ReactorDependenciesResolverMojoTest.java
Created Nov 9, 2017 — forked from vincent-zurczak/ ReactorDependenciesResolverMojoTest.java
A Maven mojo that shows how to resolve dependencies locations, be it in remote or in the local repository, or even in the reactor.
View ReactorDependenciesResolverMojoTest.java
package whatever;
import java.io.File;
import java.io.IOException;
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;