This file contains hidden or 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" | |
) | |
func main() { | |
r := permutation([]byte("abcdef")) | |
for i := range r { | |
pront(r[i]) |
This file contains hidden or 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 <stdio.h> | |
void unescape(void); | |
int main(void) | |
{ | |
printf("knr 1-10\n"); | |
printf("Unescape special characters\n"); | |
unescape(); |
This file contains hidden or 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
/* | |
Rama 9 Sort (rama9sort) | |
rama9sort is a highly efficient (and sufficient) sorting algorithm that runs in constant time and space (O(1)). | |
rama9sort got its inspiration from Stalin Sort (another highly efficient algorithm). | |
rama9sort borrows ideas from Stalin Sort - unwanted/unordered elements are discarded right away from the input, | |
although rama9sort has some other _unorthodox_ checks to make it more suitable for deployment in Thailand. | |
The differences from Stalin Sort are: |
This file contains hidden or 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 <stdio.h> | |
#define MAXLEN 1000 | |
/* Avoid confilic with stdio.h */ | |
int _getline(char line[], int limit); | |
int main(void) { | |
char line[MAXLEN]; | |
int i, j, c, len; |
This file contains hidden or 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 draw down | |
fn draw_down<T, U>(points: &[T]) -> U | |
where | |
T: Clone + Into<U>, | |
U: Copy + Default + PartialOrd + std::ops::Sub<Output = U>, | |
{ | |
if points.len() <= 1 { | |
return U::default(); | |
} |
This file contains hidden or 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
#![allow(dead_code)] | |
// Basic Rust `Iterator` and `DoubleEndedIterator` implementation on nested flattener. | |
struct Flattener<O> | |
where | |
O: Iterator, | |
O::Item: IntoIterator, | |
{ | |
outter: O, |
This file contains hidden or 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 ( | |
"crypto/rand" | |
"fmt" | |
"math/big" | |
"strings" | |
"time" | |
) |
This file contains hidden or 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 ( | |
"crypto/rand" | |
"fmt" | |
"math/big" | |
"strings" | |
"time" | |
) |
This file contains hidden or 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
fn get_largest<T: PartialOrd + Copy>(v: Vec<T>) -> T { | |
let mut largest = v[0]; | |
for item in v { | |
if largest > item { | |
largest = item | |
}; | |
}; | |
largest | |
} |
This file contains hidden or 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
#![allow(dead_code)] | |
#![allow(unused)] | |
use std::fs::File; | |
use std::io::{prelude::*, ErrorKind, Read, BufReader}; | |
use std::io; | |
fn main() { | |
let fname = ".gitignore"; |
NewerOlder