Skip to content

Instantly share code, notes, and snippets.

Avatar
🆙
Graphing

Shiny shinyzhu

🆙
Graphing
View GitHub Profile
@shinyzhu
shinyzhu / create-redis-cluster.sh
Last active Mar 3, 2019 — forked from abhirockzz/create-redis-cluster.sh
Use redis-cli to create a Redis Cluster on Docker (with Redis 5.0)
View create-redis-cluster.sh
#------------ bootstrap the cluster nodes --------------------
redis_image='redis:5'
network_name='host' # must be in host mode
#---------- create the cluster ------------------------
for port in `seq 6379 6384`; do \
start_cmd="redis-server --port $port --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes"
docker run -d --name "redis-"$port -p $port:6379 --net $network_name $redis_image $start_cmd;
View press.one
{"sig":"eccca68f69ef8a88f3fa02319163a7fb5b07445436da80bd4889a58ce8d913307551ff641578186ea46367ea4eedb1852b594029d175b891c0f2b49d57cf3af81","msghash":"85b33d53d100354f8b1c9d587f5cef58eee18f2b2483c9e65a5dad0e470c3e91"}
@shinyzhu
shinyzhu / add-progressbar.vbs
Created May 18, 2014
Add a progress bar to each slide bottom of PowerPoint.
View add-progressbar.vbs
Option Explicit
Sub AddProgressBar()
On Error Resume Next
With ActivePresentation
For X = 1 To .Slides.Count
.Slides(X).Shapes("PB").Delete
Set s = .Slides(X).Shapes.AddShape(msoShapeRectangle, _
@shinyzhu
shinyzhu / ppt-watermarks-removal.vbs
Last active Aug 29, 2015
Remove some watermarks in Powerpoint template files
View ppt-watermarks-removal.vbs
Option Explicit
Sub RemoveWatermarks()
'image watermark values
Dim imgWidth As Double, imgHeight As Double, delta As Double
imgWidth = 100.12
imgHeight = 100.12
delta = 0.1
@shinyzhu
shinyzhu / GooglePoints.cs
Last active Aug 10, 2021
Encode/Decode Polyline Algorithm Format in C#
View GooglePoints.cs
/// <summary>
/// See https://developers.google.com/maps/documentation/utilities/polylinealgorithm
/// </summary>
public static class GooglePoints
{
/// <summary>
/// Decode google style polyline coordinates.
/// </summary>
/// <param name="encodedPoints"></param>
/// <returns></returns>
View tumblrGists.min.js
var z="http://gist.github.com/",y=document.write,x=$("body"),w=$("p.gist").map(function(b,a){a=$(a);var c=$("a",a),u=c.attr("href");if(c.length&&u.indexOf(z)==0)return{p:a,id:u.substring(z.length)}}).get(),v=function(){if(w.length==0)document.write=y;else{var b=w.shift();document.write=function(){document.write=function(a){b.p.replaceWith(a);v()}};x.append('<scr'+'ipt src="'+z+b.id+'.js"></scr'+'ipt>')}};v();
@shinyzhu
shinyzhu / gist:3175082
Created Jul 25, 2012
UIColor from hex value in Objective-C
View gist:3175082
/*
UIColor from hex value in Objective-C
*/
#define UIColorFromRGB(rgbHex) [UIColor colorWithRed:((float)((rgbHex & 0xFF0000) >> 16))/255.0 green:((float)((rgbHex & 0xFF00) >> 8))/255.0 blue:((float)(rgbHex & 0xFF))/255.0 alpha:1.0]
// Usage:
UIColor *bgColor = UIColorFromRGB(0xCCEEFF);
@shinyzhu
shinyzhu / gist:2601241
Created May 5, 2012
NSLog replacement
View gist:2601241
// NSLog replacement
#define MYLogEnabled NO
#define MYLog(format, ...) \
if(MYLogEnabled){NSLog(@"%s: (Ln%i) %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:format, ## __VA_ARGS__]);}
@shinyzhu
shinyzhu / dabblet.css
Created Feb 18, 2012
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
body{background: linear-gradient(45deg, #f06, yellow);min-height: 100%;}
canvas{width:600px;height:400px;background:#cef;}
@shinyzhu
shinyzhu / inheritance.js
Created Feb 10, 2012
Inheritance in javascript
View inheritance.js
// Practices from Object Oriented Javascript
// version 0.0.0.11
(function() {
function multi() {
var n = {},
stuff, j = 0,
len = arguments.length;
for (j = 0; j < len; j++) {
stuff = arguments[j];
for (var i in stuff) {