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
// Problem 3 - https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour | |
// https://play.rust-lang.org/ | |
use std::ops::Add; | |
use std::fmt::{Debug, Formatter, Error}; | |
#[derive(Clone)] | |
struct MyUint(Vec<u8>); | |
impl Add for MyUint { |
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
// Problem 5 - https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour | |
// https://play.rust-lang.org/ | |
#[derive(Copy,Clone)] | |
enum Op { | |
Concat = 0, | |
Plus, | |
Minus | |
} |
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
// Problem 4 - https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour | |
// https://play.rust-lang.org/ | |
fn solve(list: &[u32]) -> String { | |
let mut list = list.iter() | |
.map(|&n| n.to_string()) | |
.collect::<Vec<String>>(); | |
list.sort_by(|a,b| { | |
format!("{:=<10}", b).cmp(&format!("{:=<10}", a)) | |
// Ex) [420, 42, 423] --> "42=" > "423" > "420" |
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
fn quicksort<T: Ord>(mut lst: Vec<T>) -> Vec<T> { | |
if let Some(pivot) = lst.pop() { | |
let (less, more): (Vec<_>, Vec<_>) = lst.into_iter().partition(|x| x < &pivot); | |
let mut res = quicksort(less); | |
res.push(pivot); | |
res.extend(quicksort(more)); | |
return res; | |
} else { | |
vec![] | |
} |
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 <locale> | |
#include <string> | |
#include <sstream> | |
#include <iostream> | |
#include <vector> | |
struct tsv_ctype : std::ctype<char> { | |
static const mask* make_table() | |
{ | |
static std::vector<mask> lut(classic_table(), classic_table() + table_size); |
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
// | |
// Nickname generator for TAKUMI | |
// | |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"math/rand" | |
"net/http" |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>WebGL</title> | |
<style type="text/css"> | |
<!-- | |
#c { background-color: #eee; } | |
//--> | |
</style> | |
<script id="vs" type="x-shader/x-vertex"> |
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
#!/usr/bin/env python3 | |
import sys | |
import struct | |
if len(sys.argv) != 3: | |
print("Usage: {} <source> <target>".format(sys.argv[0])) | |
quit() | |
with open(sys.argv[1]) as f: | |
hex = f.read() |
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
/* | |
* mt_cline.hpp - multithread-safe alternative cout/wcout stream (line outputter) | |
* | |
* (C) Copyright yohhoy 2015. | |
* Distributed under the Boost Software License, Version 1.0. | |
* (See copy at http://www.boost.org/LICENSE_1_0.txt) | |
*/ | |
#include <iostream> | |
#include <mutex> | |
#include <string> |
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
DEBUG?=1 | |
SRCS=$(wildcard *.cpp) | |
OBJS=$(SRCS:.cpp=.o) | |
DEPENDS=Makefile.depends | |
BOOST_PATH=$(shell brew --prefix boost) | |
CXXFLAGS=-std=c++14 -W -Wall -I$(BOOST_PATH) | |
LDFLAGS=-L$(BOOST_PATH)/lib |