Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View 6174's full-sized avatar

Marc Chen 6174

View GitHub Profile
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@6174
6174 / golang-tls.md
Created December 12, 2016 06:33 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
/*
* Javascript Diff Algorithm
* By John Resig (http://ejohn.org/)
* Modified by Chu Alan "sprite"
*
* Released under the MIT license.
*
* More Info:
* http://ejohn.org/projects/javascript-diff-algorithm/
*/
<!doctype html>
<html>
<head>
<title>Mathcha</title>
<link rel="stylesheet" href="/resources/fonts-8fdb539.css" />
<link rel="icon"
type="image/png"
href="/resources/logo.png"/>
<meta name=viewport content="width=device-width, height=device-height, initial-scale=1">
@6174
6174 / watercolors.js
Created August 16, 2021 14:11 — forked from zapthedingbat/watercolors.js
Generate watercolor style blobs: Inspired by tyler hobbs's generative watercolors- https://tylerxhobbs.com/
(function(doc) {
const TWO_PI = Math.PI * 2;
const HALF_PI = Math.PI / 2;
const RADIUS_SCALE = 0.05;
const RADIUS_SD = 15;
const POLYGON_SIDES = 5;
const POSITION_SD = 0.04;
const BASE_DEFORMATIONS = 3;
const LAYER_DEFORMATIONS = 3;
const LAYERS = 40;
@6174
6174 / canvas-blur-image.js
Last active June 28, 2022 17:50
canvas image blur
/**
* Light layer on top of a canvas element to represent an image displayed
* within. Pass in a canvas element and an Image object and you'll see the
* image within the canvas element. Use the provided methods (e.g. blur) to
* manipulate it.
*
* @constructor
* @param {HTMLElement} element HTML canvas element.
* @param {Image} image Image object.
*/
@6174
6174 / socket.io.sessionID.js
Created August 17, 2013 03:31
set session id to socket in nodejs
/**
* Module dependencies.
*/
var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var http = require('http');
var path = require('path');
/* ------------------------------------------- *\
Main
\* ------------------------------------------- */
html {
background: #DAD8DB;
text-align: center;
}
body {
font: 16px sans-serif;
color: #000;
@6174
6174 / execCommand.html
Created August 12, 2013 05:50
execCommand兼容性测试脚本
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script>
window.onload=function (){
function getCommandList(){
return {'2D-Position':true,
'absolutePosition':true,
@6174
6174 / rust_linear_regression
Last active November 13, 2019 08:54
rust linear regression
// ==================================
// linear regression trainer in rust
// @author 6174
// ==================================
// use std::cell::RefCell;
use std::vec::Vec;
fn main() {
// linear_regression();