Skip to content

Instantly share code, notes, and snippets.

View xwk's full-sized avatar

Victor Xie xwk

View GitHub Profile
@xwk
xwk / simple_dash.client_side_callback.py
Last active March 8, 2023 22:10
Simple dash demo (with client side callback)
import dash
from dash import dcc
from dash import html, Output, Input, State
from dash.dash_table import DataTable
dash.clientside_callback(
"""
function on_add_task(n_clicks, new_task_description, current_task_table_data){
const updated_task_table_data = [
...current_task_table_data,
@xwk
xwk / simple_dash.py
Last active March 8, 2023 22:10
A simple Dash app
from datetime import datetime
import dash
from dash import dcc
from dash import html, Output, Input, State
from dash.dash_table import DataTable
@dash.callback(
Output('table_task', 'data'),
@xwk
xwk / sample_google_vision_text_detection_response.json
Created October 25, 2019 02:44
sample_google_vision_text_detection_response.json
{
"responses": [
{
"textAnnotations": [
{
"locale": "en",
"description": "VNA\nWAITING?\nPLEASE\nTURN OFF\nYOUR\nENGINE\n",
"boundingPoly": {
"vertices": [
{
@xwk
xwk / gist:6fd73a9c9f5b40e5ccd83678a1735ea2
Created June 30, 2016 01:19
curl result from Sydney
curl -v -H "Pragma: akamai-x-cache-on, akamai
-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-ge
t-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no" https://9nowtestl
ivehls-i.akamaihd.net/hls/live/251421/yospace-live-ssai-poc/master.m3u8
* Hostname was NOT found in DNS cache
* Trying 119.161.91.17...
* Connected to 9nowtestlivehls-i.akamaihd.net (119.161.91.17) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
$ curl -v -H "Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no" https://9nowtestlivehls-i.akamaihd.net/hls/live/251421/yospace-live-ssai-poc/master.m3u8
* Hostname was NOT found in DNS cache
* Trying 23.63.99.72...
* Failed to set TCP_KEEPALIVE on fd 3
* Connected to 9nowtestlivehls-i.akamaihd.net (23.63.99.72) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /ec/etc/openssl/cabundle.pem
CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
@xwk
xwk / smart.xml
Created May 13, 2016 00:59
smart xml from freewheel with ad unit -14095385
<adResponse networkId='375613' version='1'>
<rendererManifest version='1'>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;adRenderers version=&apos;1&apos;&gt;&lt;adRenderer adUnit=&apos;video,slate,&apos; contentType=&apos;video/mp4-h264,video/mp4,video/m4v,video/mp4-mpeg4,video/mp4-mpeg4_simple,video/m4v-h264_less_eq_level_3_baseline-640-480-less_eq_1500_kbps-aaclc,video/mp4-h264_less_eq_level_3_baseline-640-480-less_eq_1500_kbps-aaclc,video/mov-h264_less_eq_level_3_baseline-640-480-less_eq_1500_kbps-aaclc,video/m4v-h264_less_level_1.3_baseline-320-240-less_eq_768_kbps-aaclc,video/mp4-h264_less_level_1.3_baseline-320-240-less_eq_768_kbps-aaclc,video/mov-h264_less_level_1.3_baseline-320-240-less_eq_768_kbps-aaclc,video/m4v-mpeg4-640-480-less_eq_2500_kbps-aaclc,video/mp4-mpeg4-640-480-less_eq_2500_kbps-aaclc,video/mov-mpeg4-640-480-less_eq_2500_kbps-aaclc,video/mp4-h264-baseline,&apos; creativeApi=&apos;None,&apos; name=&apos;g_html5_video_mp4&apos; slotType=&apos;preroll,midroll,pos
@xwk
xwk / double-click.xml
Created May 13, 2016 00:55
double click vast xml
<?xml version="1.0" encoding="UTF-8"?>
<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vast.xsd" version="2.0">
<Ad id="299801630">
<InLine>
<AdSystem>DCM</AdSystem>
<AdTitle>In-Stream Video</AdTitle>
<Error><![CDATA[https://pagead2.googlesyndication.com/pagead/gen_204?id=xfa_video_error&aid=299801630&cid=69931104&advid=4932901]]></Error>
<Impression><![CDATA[https://googleads4.g.doubleclick.net/pcs/view?xai=AKAOjstBJVkxQJg6dJY77wTqkMOtXMBNdwe3TlTmPqFdJBP4wLAhKX_qF72IyKs9f84aX8Qcs849sWzzwoFizAKw2UwF4TIk3S8&sig=Cg0ArKJSzEhONW_I47vCEAE&urlfix=1&adurl=]]></Impression>
<Creatives>
@xwk
xwk / vmap2.xml
Created May 13, 2016 00:54
once vmap 2
<vmap:VMAP version="1.0" xmlns:uo="uo" xmlns:vmap="http://www.iab.net/vmap-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<vmap:Extensions>
<uo:unicornOnce ttl="600" contenturi="https://once-aws-ap-southeast-2a.unicornmedia.com/now/master/playlist/e62f13e1-cab4-4fca-bdbb-eaa84d793f41/f68ef73c-99ad-464e-8e5a-b7086188a73f/895135f9-aefe-4263-9e25-ecd343f0909e/content.m3u8?oasid=396b9e3d-3c9c-42c9-9ce0-f2733aefcb93&amp;umtp=0" contentlength="5696.597" payloadlength="6416.917" contextid="396b9e3d-3c9c-42c9-9ce0-f2733aefcb93" contenttype="audio/x-mpegURL" />
<uo:contentImpressions>
<uo:Impression url="http://5bb3d.v.fwmrm.net/ad/l/1?s=f034&amp;n=375613%3B375613%3B375524&amp;t=1463100375308902004&amp;f=&amp;cn=videoView&amp;et=i&amp;uxnw=&amp;uxss=&amp;uxct=&amp;init=1&amp;ct=0" time="0" />
<uo:Impression url="http://5bb3d.v.fwmrm.net/ad/l/1?s=f034&amp;n=375613%3B375613%3B375524&amp;t=1463100375308902004&amp;f=&amp;cn=slotImpression&amp;et=i&amp;tpos=5697&amp;init=1&amp;slid=15&amp
@xwk
xwk / vmap-with-clickthrough.xml
Last active May 13, 2016 00:40
ad unit 15062286 which has click through in vmap returned by once
<vmap:AdBreak breakType="linear" breakId="MidRoll_810_0" timeOffset="00:13:30.000">
<vmap:AdSource allowMultipleAds="true" followRedirects="true" id="1">
<vmap:VASTData>
<VAST
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<Ad id="17934637188593820177">
<InLine>
<AdSystem>FreeWheel</AdSystem>
<AdTitle>midroll</AdTitle>
@xwk
xwk / vmap.xml
Created May 13, 2016 00:35
Ad unit 15535206 in Once VMAP response
<vmap:AdBreak breakType="linear" breakId="MidRoll_810_2" timeOffset="00:13:30.000">
<vmap:AdSource allowMultipleAds="true" followRedirects="true" id="3">
<vmap:VASTData>
<VAST
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Ad id="17322277">
<InLine>
<AdSystem>MediaMind</AdSystem>
<AdTitle>AGL OEWY OTV Mi9 SRR Resized</AdTitle>