This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On an Apple Silicon computer, install Rosetta 2 and the amd64 version of Go, then | |
arch -x86_64 make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::{Add, AddAssign, Mul}; | |
#[derive(Debug)] | |
struct Millimeters<T>(T); | |
struct Centimeters<T>(Millimeters<T>); | |
struct Meters<T>(Millimeters<T>); | |
/// Length represents a length in millimeters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{collections::HashMap, hash::Hash}; | |
#[derive(Debug)] | |
struct Set<T> { | |
m: HashMap<T, ()>, | |
} | |
impl<T> Set<T> | |
where | |
T: Eq + Hash + Copy, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ringbuffer | |
import ( | |
"errors" | |
"fmt" | |
) | |
type RingBuffer struct { | |
buf []interface{} | |
len int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
quicksort!(A::AbstractArray) = _quicksort!(A, 1, length(A)) | |
function _quicksort!(A::AbstractArray, low::Integer, high::Integer) | |
if low < high | |
pivot_index = partition!(A, low, high) | |
_quicksort!(A, low, pivot_index) | |
_quicksort!(A, pivot_index+1, high) | |
end | |
return A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
err := errors.New("seems we have an error here") | |
// zerolog | |
log.Error(). | |
Err(err). | |
Str("foo", "foo"). | |
Str("bar", "bar"). | |
Msg("Something happened") | |
// logrus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert(val): | |
int_val = int(val, 16) | |
int_ref = 0x700000000 | |
return hex(int_ref | int_val) | |
print(convert('0x65')) | |
print(convert('0xe6')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am harryscholes on github. | |
* I am harryscholes (https://keybase.io/harryscholes) on keybase. | |
* I have a public key whose fingerprint is 37C2 8515 CDEB 6C90 9D69 34C9 BA1D 64EE D2E0 616C | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gpg --full-generate-key --expert | |
# (9) ECC and ECC | |
# (5) NIST P-521 | |
# Get key ID | |
gpg --list-secret-keys --keyid-format LONG | |
# Export public key | |
gpg --armor --export <KEY ID> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
type semaphore struct { | |
c chan struct{} | |
} |