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 March 29, 2023 14:08
A script to convert a Vivaldi rpm or deb into Appimage format.
#!/bin/sh
#
# appimage-vivaldi.sh (version 0.2)
#
# 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 AppImageAssistant on
# your system.
@ericclemmons
ericclemmons / example.md
Last active April 24, 2024 18:09
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
@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 June 18, 2024 08:24
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 <jnthn@jnthn.net>
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.