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
/* | |
The MIT License (MIT) | |
Copyright (c) 2017 Do Duy | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
/* | |
The MIT License (MIT) | |
Copyright (c) 2017 Do Duy | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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 rgb2lab (RGB): | |
for value in RGB: | |
value = value / 255 | |
if value > 0.04045: | |
value = ((value + 0.055) / 1.055) ** 2.4 | |
else: | |
value = value / 12.92 | |
XYZ = [0, 0, 0] | |
XYZ[0] = (RGB[0] * 0.4124 + RGB[1] * 0.3576 + RGB[2] * 0.1805) / 95.047 | |
XYZ[1] = (RGB[0] * 0.2126 + RGB[1] * 0.7152 + RGB[2] * 0.0722) / 100 |
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 numpy as np | |
from sklearn.linear_model import LinearRegression | |
def f(x): | |
return 1 + 0.87*x[0] + 0.34*x[1] + 0.5*x[2] | |
X = np.random.random((2000, 3)) * 100 | |
y = [f(x) for x in X] | |
lm = LinearRegression() |
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
extern crate rand; | |
use ::std::path::PathBuf; | |
fn random(low: u64, high: u64) -> u64 { | |
low + rand::random::<u64>() % (high-low) | |
} | |
fn get_images_list(dir: &PathBuf) -> Vec<PathBuf> { | |
let paths: Vec<_> = std::fs::read_dir(dir).unwrap() |
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
# unbind all key | |
unbind -a | |
# start new session without login shell | |
set -g default-command bash | |
# allows faster key repetition | |
set -s escape-time 0 | |
# copy-paste |
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 = "jslife" | |
version = "0.1.0" | |
authors = ["Do Duy"] | |
[dependencies] | |
walkdir = "2.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
#!/usr/bin/env python | |
"""A simple starfield example. Note you can move the 'center' of | |
the starfield by leftclicking in the window. This example show | |
the basics of creating a window, simple pixel plotting, and input | |
event management""" | |
import random, math, pygame | |
from pygame.locals import * |
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 <iostream> | |
#include <cmath> | |
#include <algorithm> | |
using namespace std; | |
struct point { | |
double x, y; | |
}; | |
bool cmp_x(const point &a, const point &b) { |
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
diff --git a/Cargo.lock b/Cargo.lock | |
index c9438df8a..3cacd8e72 100644 | |
--- a/Cargo.lock | |
+++ b/Cargo.lock | |
@@ -5750,29 +5750,30 @@ dependencies = [ | |
[[package]] | |
name = "tracing" | |
version = "0.1.19" | |
-source = "git+https://github.com/tokio-rs/tracing?rev=f470db1b0354b368f62f9ee4d763595d16373231#f470db1b0354b368f62f9ee4d763595d16373231" | |
+source = "registry+https://github.com/rust-lang/crates.io-index" |
OlderNewer