Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.25882354378700256</real>
@donghaoren
donghaoren / README.md
Last active February 19, 2023 07:30
Responsive Vega Chart Demo

A responsive chart demo in Vega. The spec is a modification of a Vega-Lite output:

  • Set width and height to be signals. The signals gets their initial values from containerSize(), and listens to subsequent resize events on window:resize.
  • Use autosize: { type: "fit", contains: "padding" }. This ensures that the width / height correspond to the entire chart, not the plotting area.

Click Open and resize the window to see this example in action.

{
"state": {
"version": "1.3.0",
"dataset": {
"tables": [
{
"name": "Temperature",
"displayName": "Temperature",
"columns": [
{
@donghaoren
donghaoren / udp_forwarder.js
Last active March 6, 2023 20:23
UDP Forwarder
/*!
Copyright (c) Donghao Ren
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@donghaoren
donghaoren / udp_forwarder.py
Last active April 23, 2018 15:31
UDP Forwarder
#!/usr/bin/python
# This is a simple UDP forwarder with obfuscation support. It listens on a specific port for incoming UDP packets, and then send them to a forward address. In addition, it remembers senders’ addresses, and delivers packets from the forward address to the correct sender. Therefore it maintains ‘connections’ between the server and UDP clients.
# Usage: udp_proxy forward-ip forward-port listen-port [v6] [obfuscate] [local]
# Description:
# Listen on *:listen-port for UDP packets, forward them to forward-ip:forward-port.
# IPv6 support: forward-ip can be an ipv6 address, use option v6 to listen on ipv6 port.
# Use option obfuscate to enable packet obfuscation.
# Use option local to listen on localhost only.
import socket
@donghaoren
donghaoren / .block
Last active December 1, 2016 07:38
Stardust Example: Daily Activities
license: MIT
description: "Stardust Example: Daily Activities of Creative People"
@donghaoren
donghaoren / .block
Last active December 1, 2016 07:39
Stardust Examples: Glyphs
license: MIT
description: "Stardust Example: Glyph-based Visualization"
@donghaoren
donghaoren / .block
Last active December 1, 2016 07:39
Stardust Example: Force-directed Graph
license: MIT
description: "Stardust Example: Force-directed Graph"
@donghaoren
donghaoren / .block
Last active December 1, 2016 07:39
Stardust Example: Squares
license: bsd-3-clause
description: "Stardust Example: Squares"
@donghaoren
donghaoren / .block
Last active December 1, 2016 07:39
Stardust Example: Isotype
license: mit
description: "Stardust Example: Isotypes"