Skip to content

Instantly share code, notes, and snippets.

View lengyijun's full-sized avatar
🦄

lyj lengyijun

🦄
View GitHub Profile
@primaryobjects
primaryobjects / react-confirm.js
Created November 1, 2017 19:03
A simple example of a confirm alert dialog in ReactJs / React.
<div className='delete-button' onClick={() => { if (window.confirm('Are you sure you wish to delete this item?')) this.onCancel(item) } } />
@ruario
ruario / appimage-vivaldi.sh
Last active September 30, 2024 18:44
A script to convert a Vivaldi rpm or deb into Appimage format.
#!/bin/sh
#
# appimage-vivaldi.sh (version 0.9)
#
# A script to convert a Vivaldi rpm or deb into AppImage format.
# Before you use this script, you may need to adjust the following
# variable, based on the name and location of AppImageTool on your
# system.
#
@ericclemmons
ericclemmons / example.md
Last active September 20, 2024 12:46
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@jms137
jms137 / goldbach47.c
Created May 12, 2016 13:46
Goldbach Turing machine with 47 states
/*
Goldbach's conjecture tested by a 47-state Turing machine
Author: Jared Showalter
If "a" and "i" were unbounded, this program would halt iff Goldbach's
conjecture is false. Furthermore, the program structurally
corresponds to a Turing machine with two symbols, one tape, and a
small number of states. The array "a" corresponds to the tape (each
@byronhe
byronhe / ecdsa_demo.cpp
Created August 11, 2015 15:08
ecdsa key generate / sign / verify demo
#include <openssl/ecdsa.h>
#include <openssl/ecdh.h>
#include <openssl/evp.h>
#include <openssl/sha.h>
#include <openssl/bio.h>
#include <openssl/pem.h>
#include <iostream>
#include <string>
#include <cassert>
@sergiotapia
sergiotapia / md5-example.go
Last active December 5, 2023 03:53
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@masak
masak / explanation.md
Last active October 2, 2024 09:32
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <[email protected]>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.