Skip to content

Instantly share code, notes, and snippets.

View yaodong's full-sized avatar

Yaodong Zhao yaodong

View GitHub Profile
title date tags categories
How to get started to build your own Spacemacs
2018-10-12 12:59
emacs
Tools

I have been a Vim user for quite a while. I love it, so the very first thing when I set up a new server is installing VIM. I heard a lot about Emacs and tried it. It's better at almost everything except text editing. So I stayed with Vim until Spacemacs was released. The Vim key bindings of Spacemacs is so excellent that I switched.

However, Spacemacs has its problem: boots up slowly and crashes frequently. Upgrading packages became very challenging. Finally, I have to use the develop branch because the master branch is not working anymore. People began to complain and requested to speed up the release from the master branch. Considering its dependencies and numerous open issues, I have no hope for this.

@yaodong
yaodong / download_leetcode_problem_list.rb
Last active March 29, 2019 20:15
leetcode problems list
#!/usr/bin/ruby
require 'net/http'
require 'json'
require 'yaml'
url = URI('https://leetcode.com/api/problems/algorithms/')
res = Net::HTTP.get(url)
data = JSON.parse(res)
problems = data['stat_status_pairs'].map do |pair|

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String args[] ) throws Exception {
int[][] input = new int[][]{
@yaodong
yaodong / kalloc.c
Last active February 9, 2019 20:53
// Physical memory allocator, intended to allocate
// memory for user processes, kernel stacks, page table pages,
// and pipe buffers. Allocates 4096-byte pages.
#include "types.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "spinlock.h"
@yaodong
yaodong / r1.py
Last active September 9, 2018 05:04
{'_node': 'spore-print-color',
'decisions': [['k',
{'_node': 'gill-size',
'decisions': [['n',
{'_node': 'population',
'decisions': [['s', {'label': 'p'}],
['v',
{'_node': 'cap-surface',
'decisions': [['y',
{'label': 'p'}],
class Solution {
public int[] findDiagonalOrder(int[][] matrix) {
if (matrix.length == 0) {
return new int[0];
}
int m = matrix.length, n = matrix[0].length;
int[] result = new int[m*n];
docker run -it --rm --name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
-p 80:80 \
certbot/certbot certonly
FooMixin = Ember.Mixin.create({
init: function () {
this._super(); // This will call Em.Object#init in the super chain
console.log('FooMixin#init');
}
});
BarMixin = Ember.Mixin.create({
init: function () {
this._super(); // This will call FooMixin#init in the super chain
@yaodong
yaodong / celery_nested_tasks.py
Created March 4, 2017 06:29
celery workflow test #temp
from celery import shared_task, chord, chain, group
@shared_task()
def workflow_test(*args, name="", time=2):
print('name [%s] %s' % (name, args))
sleep(time)
return name
chord(
header=group(