Skip to content

Instantly share code, notes, and snippets.

@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
int[][] result;
float t, c;
float ease(float p) {
@shaneutt
shaneutt / LICENSE
Last active April 14, 2024 00:52
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@rogpeppe
rogpeppe / vgoget.sh
Last active August 4, 2023 07:07
go get binary@version
#!/bin/sh
# This command installs binaries at specified versions
# into $GOBIN, $GOPATH/bin or $HOME/bin.
# It assumes Go 1.11.
if [ $# = 0 ]; then
usage: vgoget cmdpackage[@version]... >&2
exit 2
fi
d=`mktemp -d`
cd "$d"
@tommyettinger
tommyettinger / mulberry32.c
Last active February 5, 2024 20:32
Mulberry32 PRNG
/* Written in 2017 by Tommy Ettinger (tommy.ettinger@gmail.com)
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include <stdint.h>
@movitto
movitto / keyboard_in.rb
Created September 13, 2017 01:10
/dev/input/event keyboard parser
#!/usr/bin/ruby
# Read keyboard presses / release / holds on Linux
# Released under the MIT License
# Use binary_struct to process blobs
require_relative 'binary_struct'
##################!!!!######################
#!!!!CHANGE ME TO YOUR KEYBOARD DEVICE!!!!!#
############################################
package main
import (
"fmt"
"log"
"os"
"os/exec"
"syscall"
)
@tidwall
tidwall / 3000000.sh
Last active May 25, 2016 20:38
Tile38 3,000,000 nearby test
# Pull the latest tile38/master branch.
# Start Tile38 server in dev mode and very verbose.
./tile38-server -dev -vv
# From another terminal run use the CLI to insert 3,000,000 random points around the Silicon Valley area.
# This will create a collection key "mi:0" with points ids "0" - "2999999".
./tile38-cli massinsert 1 3000000 37.10776 -122.67145 38.19502 -121.62775
# Update location for point id "1001".
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@tevino
tevino / epoll.go
Last active January 20, 2024 22:50
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (