Skip to content

Instantly share code, notes, and snippets.

@codeyu
codeyu / hiragana2romaji.js
Created August 30, 2024 22:12 — forked from shimataro/hiragana2romaji.js
ひらがな→ローマ字変換
exports.default = hiragana2romaji;
// 変換テーブル; 文字数の多いものから登録していく
const convtables = [
{ // 3文字
"っきゃ": "kkya",
"っきぃ": "kkyi",
"っきゅ": "kkyu",
"っきぇ": "kkye",
"っきょ": "kkyo",
@codeyu
codeyu / put_apple_to_basket.cs
Last active December 13, 2019 09:39
put_apple_to_basket
using System;
using System.Linq;
namespace put_apple_to_basket
{
class Program
{
static void Main(string[] args)
{
var apples = new int[] { 6, 16, 26, 36, 46, 56, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69 };
var r = 6;
/**
匹配身份证号码
**/
function isIdCardNo(num) {
if (num == null || num == "") {
alert("请输入身份证号码!");
return false;
}
//去除字符串收尾空格
@codeyu
codeyu / CryptoRandom.cs
Created December 24, 2017 14:31 — forked from prettycode/CryptoRandom.cs
Cryptographically-strong random number generator in C#.
// Cryptographically-strong random number generator
// Source: MSDN Magazine > 2007 > September > .NET Matters: Tales from the CryptoRandom
// Source URL: http://msdn.microsoft.com/en-us/magazine/cc163367.aspx
// Authors: Stephen Toub & Shawn Farkas
public class CryptoRandom : Random
{
private RNGCryptoServiceProvider cryptoProvider = new RNGCryptoServiceProvider();
private byte[] uint32Buffer = new byte[4];
@codeyu
codeyu / k8s-pi.md
Created December 12, 2017 05:51 — forked from alexellis/k8s-pi.md
K8s on Raspbian

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup

@codeyu
codeyu / gh-pages-deploy.md
Created August 14, 2017 00:31 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

<html>
<head>
<title>3D动态玫瑰(js实现)</title>
<meta charset="utf-8" />
</head>
<body>
<canvas id="c"></canvas>
<script>
<!DOCTYPE html>
<html>
<body>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
@codeyu
codeyu / ServiceController.cs
Created May 22, 2017 16:05
C# code completion using Roslyn. Beta.
//server's code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using reExp.Utils;
@codeyu
codeyu / csharp_daemon_demo.cs
Created April 25, 2017 01:54
一个完整的linux daemon示例
using System;
using System.Threading;
using System.Timers;
using System.Runtime.InteropServices;
using System.IO;
using System.Text;
/********************************************
* 一个完整的linux daemon示例,作者宇内流云 *