Skip to content

Instantly share code, notes, and snippets.

View cwhy's full-sized avatar

Chen Yu cwhy

View GitHub Profile
@mrdwab
mrdwab / LinearizeNestedList.R
Created December 4, 2012 16:00
Un-nest a nested list in R
LinearizeNestedList <- function(NList, LinearizeDataFrames=FALSE,
NameSep="/", ForceNames=FALSE) {
# LinearizeNestedList:
#
# https://sites.google.com/site/akhilsbehl/geekspace/
# articles/r/linearize_nested_lists_in_r
#
# Akhil S Bhel
#
# Implements a recursive algorithm to linearize nested lists upto any

Git Cheat Sheet

Commands

Getting Started

git init

or

@parmentf
parmentf / GitCommitEmoji.md
Last active July 23, 2024 11:27
Git Commit message Emoji
@yang-wei
yang-wei / destructuring.md
Last active July 4, 2024 16:56
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@AndreasS2501
AndreasS2501 / Blockchains.md
Last active September 19, 2018 14:32
How to think an impossible thought?

On Blockchains - Postcapitalism - in response to: Postcapitalism by Jamie Dobson https://www.youtube.com/watch?v=MGdQnL4-H9M

An impossible thought?

But what do we want to think? I think many people want the same thing (see maslov pyramid of needs). But the ever interesting question in the history of humanity was: How to do that so that there exists an equilibrium between all humans (society) and the rest of the planet (nature). Personally I see post-capitalism as a part of a solution for that, but economy is only one thing that should change. To conceive such a complex balance is not a simple thing. Alan Kay often talks about how the internet has some biological ideas in it and yes I think to achieve that balance we need some kind of network organism where everyone is connected and heard. Even nature. So lets focus on that, the impossible thought: How can we live together in peace and prosperity with each other and nature? Sometimes, somehow this reminds me of the https://en.wikipedia.org/wiki/K

@kordless
kordless / README.md
Last active July 5, 2024 03:52
Rust Server Deployment for Google Container Engine

Howdy Y'all! I'm @kordless on YouTube and I occasionally play and stream Rust, the game.

This repo is for deploying a Rust Server running on Google Container Engine. Google has a deal going where you can get $300 of free credits for a year on Google Cloud, so it's a good excuse to signup and run your own server. And no, I don't work for Google!

This deployment uses an image built by @dids, which is hosted on Docker Hub: https://hub.docker.com/r/didstopia/rust-server/

This deployment method can be used to start a small server to play with friends or practice building things. In a few days, I'll update the scripts to include a way to save the content you've created, in-game, with others who can then run their own servers and load your content in to explore it for themselves.

For now, start by navigating to Google Cloud and signup for an account. You'll need to enter some credit card details to get this going, but Google is giving you $300 in credits for the next year. Should be e

@wmakley
wmakley / Lessons_Learned_From_a_Year_of_Elm.md
Last active November 15, 2017 18:26
Lessons Learned From a Year of Elm

Lessons Learned From a Year of Elm

These are some of the lessons I wish I had learned when I first picked up Elm, before I wrote a bunch of apps that are now more difficult to maintain than they need to be.

1. Not Everything Needs to be a Package.

Breaking an Elm program up into multiple files just to reduce scrolling does not tend to work out optimally. Evan gave a really cool talk on this called "The life of a file". Files should split organically around data structures, not just to stay short. The reasons we want to keep JavaScript files as short as possible do not apply to Elm.

For example, I've created apps with a file structure like this:

@t-vi
t-vi / __init__.pyi
Last active July 13, 2023 09:11
PyTorch Type Hints work in progress (put into python3.x/dist-packages/torch/ directory to try)
from typing import List, Tuple, Optional, Union, Any, ContextManager, Callable, overload
import builtins
import math
import pickle
class dtype: ...
_dtype = dtype
@mikhailov-work
mikhailov-work / turbo_colormap.py
Created August 8, 2019 23:31
Turbo Colormap Look-up Table
# Copyright 2019 Google LLC.
# SPDX-License-Identifier: Apache-2.0
# Author: Anton Mikhailov
turbo_colormap_data = [[0.18995,0.07176,0.23217],[0.19483,0.08339,0.26149],[0.19956,0.09498,0.29024],[0.20415,0.10652,0.31844],[0.20860,0.11802,0.34607],[0.21291,0.12947,0.37314],[0.21708,0.14087,0.39964],[0.22111,0.15223,0.42558],[0.22500,0.16354,0.45096],[0.22875,0.17481,0.47578],[0.23236,0.18603,0.50004],[0.23582,0.19720,0.52373],[0.23915,0.20833,0.54686],[0.24234,0.21941,0.56942],[0.24539,0.23044,0.59142],[0.24830,0.24143,0.61286],[0.25107,0.25237,0.63374],[0.25369,0.26327,0.65406],[0.25618,0.27412,0.67381],[0.25853,0.28492,0.69300],[0.26074,0.29568,0.71162],[0.26280,0.30639,0.72968],[0.26473,0.31706,0.74718],[0.26652,0.32768,0.76412],[0.26816,0.33825,0.78050],[0.26967,0.34878,0.79631],[0.27103,0.35926,0.81156],[0.27226,0.36970,0.82624],[0.27334,0.38008,0.84037],[0.27429,0.39043,0.85393],[0.27509,0.40072,0.86692],[0.27576,0.41097,0.87936],[0.27628,0.42118,0.89123],[0.27667,0.43134,0.90254],[0.27691,0.44145,0.913