Skip to content

Instantly share code, notes, and snippets.

View rzhw's full-sized avatar

Richard Wang rzhw

View GitHub Profile

Keybase proof

I hereby claim:

  • I am rzhw on github.
  • I am rzhw (https://keybase.io/rzhw) on keybase.
  • I have a public key whose fingerprint is 5837 31A6 D0B8 BE23 4837 545C 6E8B 8497 F6EF 6F56

To claim this, I am signing this object:

@rzhw
rzhw / pempublickeytest.c
Last active August 29, 2015 14:21
PEM RSA public key to RSA struct
// gcc pempublickeytest.c -lssl -lcrypto -I/usr/include/openssl/ -o pempublickeytest
#include <stdio.h>
#include <stdlib.h>
#include <openssl/rsa.h>
#include <openssl/bio.h>
#include <openssl/pem.h>
int main() {
BIO *bio = BIO_new_file("blah_rsa.pub.pem", "r");
@rzhw
rzhw / README.md
Last active August 29, 2015 14:04 — forked from andersonimes/gist:2490459
ReactiveUI property code snippet fork
  • Separate public/private literals
  • For RxUI 5
  • No private
  • Single line get/set
@rzhw
rzhw / gist:18852f2e95fa30d0aaf3
Created May 26, 2014 12:19
Atom 0.99.0 EditorView testing
atom.workspaceView.getEditorViews()[0].scrollView.on('mousewheel', function(){alert('hi')})
http://stackoverflow.com/a/21261771/77922
jQuery = require('atom').$
findEventHandlers("mousewheel", atom.workspaceView.getEditorViews()[0].scrollView)
atom.workspaceView.getActiveView().is(".editor")
using Cirrious.MvvmCross.ViewModels;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Blah
@rzhw
rzhw / gist:6220148
Created August 13, 2013 11:14
cygwin 1.7.23 clang++, you make perfect sense to me
alias clang++='clang++ -I"/usr/lib/gcc/i686-pc-cygwin/4.7.3/include/c++/i686-pc-cygwin/" -I"/usr/lib/gcc/i686-pc-cygwin/4.7.3/include/c++/"'
@rzhw
rzhw / StoryboardAction.cs
Created February 23, 2013 03:52
StoryboardAction for Windows.UI.Interactivity on WinRT / Windows Runtime
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Interactivity;
namespace Windows.UI.Interactivity
{
[ContentProperty(Name = "Storyboard")]
public class StoryboardAction : Windows.UI.Interactivity.TriggerAction<FrameworkElement>
@rzhw
rzhw / gist:3449336
Created August 24, 2012 11:19
Basic SSH/SCP use rolled into a Bash function
cse_func()
{
host='username@hostname'
if [ "$1" == 'push' ] ; then
location=$2
files=`echo "$@" | cut -d' ' -f3-`
scp $files $host:"$location"
elif [ "$1" == 'pull' ]; then
if [ $# -gt 3 ]; then
echo "$0: to pull multiple files, write \{remote-file1,remote-file2,...\}"
@rzhw
rzhw / HotkeyInputBox.cs
Created December 13, 2011 02:55
Hotkey input box for WinForms
// HotkeyInputBox 0.1 (c) 2011 Richard Z.H. Wang
// MIT licensed.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
@rzhw
rzhw / welp.rb
Created March 26, 2011 01:18
Creates a CSV for DISQUS' migration tool for cases where the root directory name is different, but the permalinks are the same
#!/usr/bin/env ruby
# Written by Richard Z.H. Wang, based on wordpressxml2jekyll.rb
require 'rubygems'
require 'hpricot'
require 'clothred'
require 'time'
require 'yaml'
require 'fileutils'