Skip to content

Instantly share code, notes, and snippets.

View rm--'s full-sized avatar

René rm--

View GitHub Profile
@rm--
rm-- / _.js
Last active November 8, 2021 15:17
sha512 digest to int
async function digestMessage(message) {
const encoder = new TextEncoder();
const data = encoder.encode(message);
const hash = await crypto.subtle.digest('SHA-512', data);
return hash;
}
digestMessage('input')
.then(digestBuffer => console.log(new DataView(digestBuffer).getUint32()));
3698158640
@rm--
rm-- / _.py
Last active November 8, 2021 15:15
sha512 digest to int
import hashlib
h = hashlib.sha512()
h.update('input'.encode('utf-8'))
int(h.hexdigest()[0:8], base=16)
3698158640
@rm--
rm-- / g-filter-branch.md
Last active July 19, 2022 08:36
git filter-branch replace author commiter email

all branches and tags:

git filter-branch --env-filter 'GIT_AUTHOR_EMAIL=<author mail adress> GIT_COMMITTER_EMAIL=<committer mail adress>' -- --all

last three commits

git filter-branch --env-filter 'GIT_AUTHOR_EMAIL=<author mail adress> GIT_COMMITTER_EMAIL=<committer mail adress>' HEAD~3..HEAD

testing

execute tests

go test .

execute all tests?

go test ./...

@rm--
rm-- / custom-wishlist-page.js
Created April 6, 2021 12:22 — forked from aravindbaskaran/custom-wishlist-page.js
Swym Wishlist Plus - Custom Wishlist UX for your site - An example using the Supply theme
(function(){
var _products = {};
if(!window.SwymCallbacks){window.SwymCallbacks = [];}
window.SwymCallbacks.push(function(){
_swat.fetchWrtEventType(function(products){
// render products - array of objects with same structure as productData
// {{Insert your rendering function}}
renderProducts(products);
// products count - products.length
// {{Insert your count update}}
https://www.jshero.net/en/koans/random.html
const dice = function(){
return Math.round(Math.random()*10)%6+1;
}
https://www.jshero.net/en/koans/parseint.html
const add = function(input){
const plusSignIndex = input.indexOf('+')
return parseInt(input.substring(0,plusSignIndex), 10)+parseInt(input.substring(plusSignIndex+1), 10);
@rm--
rm-- / bluetooth codec.md
Last active May 17, 2021 07:00
fix sennheiser bluetooth 'call ended' voice message

sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true

sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true

sudo defaults read bluetoothaudiod

@rm--
rm-- / first commit.md
Last active August 17, 2020 09:43
first (bottom) git commit

git commit --allow-empty -m "⊥"

@rm--
rm-- / convert.md
Last active June 13, 2020 15:30
convert mov to mp4 keep audio/video information

ffmpeg -i input.mov -c:v copy -c:a copy output.mp4