Skip to content

Instantly share code, notes, and snippets.

View yiwang's full-sized avatar

Yi Wang yiwang

View GitHub Profile
@yiwang
yiwang / geojson_to_h3_hexagons.py
Created May 3, 2021 03:17 — forked from ThomasG77/geojson_to_h3_hexagons.py
Take a GeoJSON as an input, take all H3 hexagons within and output GeoJSON hexagons with their id
from h3 import h3
geoJson = {'type': 'Polygon',
'coordinates': [[[37.813318999983238, -122.4089866999972145],
[ 37.7866302000007224, -122.3805436999997056 ],
[37.7198061999978478, -122.3544736999993603],
[ 37.7076131999975672, -122.5123436999983966 ],
[37.7835871999971715, -122.5247187000021967],
[37.8151571999998453, -122.4798767000009008]]] }
@yiwang
yiwang / MacEditorTextView.swift
Created April 25, 2020 02:16 — forked from unnamedd/MacEditorTextView.swift
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@yiwang
yiwang / active.md
Created June 6, 2018 23:51 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@yiwang
yiwang / README.md
Created May 13, 2018 17:00 — forked from porglezomp/README.md
Serializing Binary Data in Rust

Serializing Binary Data in Rust

The way I like to serialize data in Rust into binary formats is to let a data structure blit itself into a mutable buffer. This is a relatively composable, low level way to work that lends itself to having other abstractions built on top of it. I recently was serializing network packets, so let's make up a small packet format that illustrates how we can do this.

+-------------+-------------+
|  Tag (u16)  | Count (u16) |
+-------------+-------------+
|                           |
~        Entry (u32)        ~
@yiwang
yiwang / rapid-mobile-development.rst
Created May 7, 2018 14:42 — forked from freakboy3742/rapid-mobile-development.rst
Rapid Mobile Application Development with Python

Rapid mobile application development with Python

While there are examples of Python-based apps in mobile App stores, the knowledge of how to actually create a mobile app in Python hasn't been well documented, or simplified for mass use - until now.

In this talk, Dr Russell Keith-Magee will demonstrate a collection of tools from the BeeWare Project that enable you to build a cross-platform mobile app using Python in a matter of minutes.

Audience

@yiwang
yiwang / dateDiff.php
Created April 9, 2018 13:12 — forked from victorcastelan/dateDiff.php
Get a date diff between 2 dates
/*
example:
$count_from = "2010-09-30 00:00:01"; // 24-Hour Format: YYYY-MM-DD HH:MM:SS"
$count_to = date("Y-m-d H:i:s");//today (2012-08-23 00:00:01)
echo datediff("d",$count_from,$count_to);
return: 693 (days)
*/
function datediff($interval, $datefrom, $dateto, $using_timestamps = false) {
/*
@yiwang
yiwang / cargo.toml
Created April 5, 2018 02:06 — forked from AljoschaMeyer/cargo.toml
Example of statically typed messages.
[package]
name = "demo-ssb-client"
version = "0.1.0"
authors = ["AljoschaMeyer <mail@aljoscha-meyer.de>"]
[dependencies]
tokio = "0.1.3"
futures = "0.1.18"
sodiumoxide = "0.0.16"
Verifying my Blockstack ID is secured with the address 16Uh2TkCjvuY4h1bEoBFhtBY7jAhkVnkMR https://explorer.blockstack.org/address/16Uh2TkCjvuY4h1bEoBFhtBY7jAhkVnkMR
@yiwang
yiwang / arch_setup.sh
Created September 4, 2017 00:24 — forked from gutoandreollo/arch_setup.sh
Installing Arch Linux with an encrypted btrfs root, with GPT and UEFI support
# Install arch linux in an encrypted btrfs partition with GPT and UEFI support, gummiboot and hibernate/resume support
# sources:
# http://hole.tuziwo.info/install-arch-linux-on-uefi-gpt-computer-with-btrfs-support.html
# http://www.brunoparmentier.be/blog/how-to-install-arch-linux-on-an-encrypted-btrfs-partition.html
# https://wiki.archlinux.org/index.php/Dm-crypt/Swap_encryption
# Take note of this:
# - The first thing you need is to identify which disk you're going to use. For the purpose of this guide, it will be /dev/sda
# Be VERY CAREFUL if you have more than one disk on your computer, and DOUBLE CAREFUL if one of them is the one with your backups
# - Since btrfs does not support swapfiles (yet), we'll create a swap partition. In this guide, it will NOT be encrypted
@yiwang
yiwang / configuration.nix
Created August 3, 2017 14:56 — forked from DamienCassou/configuration.nix
configuration.nix file for NixOS on my macbook pro
{ config, pkgs, ... }:
let
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# I use VirtualBox to connect to Windows and Linux guests