Skip to content

Instantly share code, notes, and snippets.


Yoga Lin blueandhack

View GitHub Profile
cowlicks / apollo_ws_subscription_graphql_auth.js
Last active May 16, 2020
Dynamic auth tokens for Websockets with Graphql Subscriptions
View apollo_ws_subscription_graphql_auth.js
const subscriptionMiddleware = {
applyMiddleware: function(options, next) {
// Get the current context
const context = options.getContext().graphqlContext;
// set it on the `options` which will be passed to the websocket with Apollo
// Server it becomes: `ApolloServer({contetx: ({payload}) => (returns options)
options.authorization = context.authorization;
ngbrown / ApolloLoggingExtension.ts
Created Mar 29, 2019
Custom logging in Apollo Server 2 using the extension API
View ApolloLoggingExtension.ts
import {GraphQLExtension, GraphQLResponse} from 'graphql-extensions';
import {formatApolloErrors} from 'apollo-server-errors';
import {GraphQLError, GraphQLFormattedError} from 'graphql';
import Logger from 'bunyan';
import icepick from 'icepick';
const filterOutErrorPaths = [
['extensions', 'exception', 'options', 'auth', 'bearer'],
zthxxx / Activate Office 2019 for macOS
Last active Aug 11, 2020
crack activate office on mac with license file
View Activate Office 2019 for macOS

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above


Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.


jayliew /
Created Mar 22, 2018
USB barcode scanner read in Python on Raspberry Pi Raspbian
# Props to user brechmos for sharing the code here:
# Tested with the following barcode scanner
# macbook# ioreg -p IOUSB
# <snip>
# | +-o WIT 122-UFS V2.03@14200000 <class AppleUSBDevice, id 0x10000c3c4, registered, matched, active, busy 0 (6 ms), retain 14>
# WIT 122-UFS V2.03:
# Product ID: 0x1010
# Vendor ID: 0x05fe (CHIC TECHNOLOGY CORP)
lakshmantgld /
Last active Jan 5, 2020
Free Sales Tax API based on Postal code by Avalara

Sales Tax API

There are many companies providing sales tax API. Out of all the companies, Avalara offers free API service for sales Tax. This gist is all about setting up avalara API and querying it.

The Free-To-Use API by avalara has some restrictions. Usage of this API is subject to rate limits. Users who exceed the rate limit will receive HTTP response code 429 - Too Many Requests. The requirement for this API is to create an avalara free trail account. You can create a free account using this link create free account.

Once you have filled the form from above link, you will get an e-mail containing temporary credentials to login the avalara account. The e-mail will look something like this:

Avalara e-mail

0x263b /
Last active Jul 3, 2020
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
View surge.conf
skip-proxy =,,,,, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun =,,
# dns-server =,,
loglevel = notify
BJ-All = custom
BJ-HK-Azure = custom
BJ-US-Azure = custom
selsta / autosub.lua
Last active Jul 5, 2020
Automatically download subtitles in mpv using subliminal.
View autosub.lua
-- requires subliminal, version 1.0 or newer
-- default keybinding: b
-- add the following to your input.conf to change the default keybinding:
-- keyname script_binding auto_load_subs
local utils = require 'mp.utils'
function load_sub_fn()
subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path"Searching subtitle")
mp.osd_message("Searching subtitle")
t = {}
P233 / ios7-theme-for-v2ex
Last active Dec 9, 2016
View ios7-theme-for-v2ex
a:link, a:visited, a:active {
color: #8e8d93;
-webkit-transition: all .15s;
-moz-transition: all .15s;
-ms-transition: all .15s;
-o-transition: all .15s;
transition: all .15s;
},, {
color: #000;
You can’t perform that action at this time.