Skip to content

Instantly share code, notes, and snippets.

View seaoak's full-sized avatar

Seaoak seaoak

View GitHub Profile
@seaoak
seaoak / main.rs
Created January 17, 2022 08:13
Rust sample of simple parallel program with Rayon crate
use std::cmp::Ordering;
use std::str::FromStr;
use std::time::{Duration, SystemTime};
use rand::distributions::Standard;
use rand::{Rng, SeedableRng};
use rand_xoshiro::Xoshiro256PlusPlus;
#[allow(unused_imports)]
use rayon::prelude::*;
@seaoak
seaoak / post_permalink.js
Created July 5, 2017 02:33
hexo-post-permalink - a tag plugin for [Hexo](https://hexo.io)
'use strict';
// {% post_permalink [slug] %}
hexo.extend.tag.register('post_permalink', function (args) {
const slug = args.shift();
if (!slug) return this.permalink;
const post = hexo.model('Post').findOne({slug: slug});
if (!post) return;
function stringify(arg0) {
const memo = new Set();
function helper(arg, indent) {
if (typeof(arg) === 'undefined') return 'undefined';
if (typeof(arg) === 'boolean') return arg.toString();
if (typeof(arg) === 'number') return arg;
if (typeof(arg) === 'string') return '"' + arg.substr(0, 32).replace(/\n/g, '\\n') + '"';
if (typeof(arg) === 'symbol') return 'SYMBOL';
if (typeof(arg) === 'function') return 'FUNCTION';
@seaoak
seaoak / index.html
Created December 25, 2016 06:55
hexo Issue #2328 - my index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hexo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta property="og:type" content="website">
<meta property="og:title" content="Hexo">
<meta property="og:url" content="http://yoursite.com/index.html">