identical mmap programs in C and go
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
private fun sweepGradientShaderWithOffset( | |
vararg colorStops: Pair<Float, Color>, | |
offset: Float = 0f, | |
center: Offset = Offset.Unspecified | |
): Brush { | |
return object : ShaderBrush() { | |
override fun createShader(size: Size): Shader { | |
// https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Brush.kt;l=576-583;drc=a18f72ab3de68971fb30d894d41f4441aa09fd4f | |
val normalizedCenter = | |
if (center.isUnspecified) { |
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
#include <arpa/inet.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
int main() { | |
const char* server_name = "localhost"; | |
const int server_port = 8877; |
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
#include <arpa/inet.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
int main() { | |
const char* server_name = "localhost"; | |
const int server_port = 8877; |
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] | |
name = "min-char-rnn-rs" | |
version = "0.1.0" | |
authors = ["Suyash <suyash93@protonmail.com>"] | |
edition = "2018" | |
[dependencies] | |
rulinalg = "0.4.2" | |
rand = "0.6.4" | |
indicatif = "0.11.0" |
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
//! Knuth-Morris-Pratt implementation | |
//! | |
//! See Chapter 17 in Blandy + Orendorff | |
/// computes the KMP longest prefix-suffix function | |
pub fn kmp<T: AsRef<[u8]>>(pattern: T) -> Vec<usize> { | |
let pattern = pattern.as_ref(); | |
let n = pattern.len(); | |
let mut ans = vec![0; n + 1]; |
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
//! Generic Segment Tree implemented for custom comparator and min functions. | |
//! | |
//! See Chapters 15, 16 in Blandy and Orendorff | |
/// Segment Tree allows for querying information over ranges in a continuous data stream. | |
pub struct SegmentTree<T, Comparator, Minimum> { | |
tree: Vec<T>, | |
n: usize, | |
f: Comparator, | |
d: Minimum, |
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
import { Store } from 'express-session'; | |
import JFS from 'jfs'; | |
export default class JFSStore extends Store { | |
constructor(location) { | |
super(); | |
this.db = new JFS(location || 'data'); | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder