Skip to content

Instantly share code, notes, and snippets.

View yuehhua's full-sized avatar

Yueh-Hua Tu yuehhua

View GitHub Profile
-- This exercise covers the first 6 chapters of "Learn You a Haskell for Great Good!"
-- Chapter 1 - http://learnyouahaskell.com/introduction
-- Chapter 2 - http://learnyouahaskell.com/starting-out
-- Chapter 3 - http://learnyouahaskell.com/types-and-typeclasses
-- Chapter 4 - http://learnyouahaskell.com/syntax-in-functions
-- Chapter 5 - http://learnyouahaskell.com/recursion
-- Chapter 6 - http://learnyouahaskell.com/higher-order-functions
-- Download this file and then type ":l Chapter-1-6.hs" in GHCi to load this exercise
@yuehhua
yuehhua / eigenvectors_from_eigenvaluies.jl
Last active November 17, 2019 15:33
A Julia demo script of [the paper EIGENVECTORS FROM EIGENVALUES](https://arxiv.org/pdf/1908.03795.pdf), modified from [Yu-Chen Shu](https://www.facebook.com/yuchen.shu/posts/10157876738839228) rewritten in Julia.
using LinearAlgebra: eigvals, eigvecs
N = 12
A = rand(N, N)
A = A + A'
function new_eigvecs(A::AbstractMatrix, n=size(A,1)::Integer)
U = similar(A)
λ = eigvals(A)
for i = 1:n
using Plots
H = 10000 # H horizontal lines
V = 50 # V vertical lines
N = 10000 # sample size
function ghostleg(x)
if x == 1
return x + 1
elseif x == V
@yuehhua
yuehhua / Error
Created October 17, 2019 17:20
GeometricFlux Error
Reason: unsupported call through a literal pointer (call to )
Stacktrace:
[1] fill! at array.jl:366
[2] #IOBuffer#318 at iobuffer.jl:121
[3] multiple call sites at unknown:0
Stacktrace:
[1] check_ir(::CUDAnative.CompilerJob, ::LLVM.Module) at /builds/JuliaGPU/GeometricFlux-jl/.julia/packages/CUDAnative/Lr0yj/src/compiler/validation.jl:114
[2] macro expansion at /builds/JuliaGPU/GeometricFlux-jl/.julia/packages/CUDAnative/Lr0yj/src/compiler/driver.jl:188 [inlined]
[3] macro expansion at /builds/JuliaGPU/GeometricFlux-jl/.julia/packages/TimerOutputs/7zSea/src/TimerOutput.jl:216 [inlined]
[4] #codegen#136(::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::typeof(CUDAnative.codegen), ::Symbol, ::CUDAnative.CompilerJob) at /builds/JuliaGPU/GeometricFlux-jl/.julia/packages/CUDAnative/Lr0yj/src/compiler/driver.jl:186
Traceback (most recent call last):
File "/media/pika/Workbench/workspace/testcelery/venv/lib/python3.7/site-packages/kombu/serialization.py", line 50, in _reraise_errors
yield
File "/media/pika/Workbench/workspace/testcelery/venv/lib/python3.7/site-packages/kombu/serialization.py", line 221, in dumps
payload = encoder(data)
File "/media/pika/Workbench/workspace/testcelery/venv/lib/python3.7/site-packages/kombu/utils/json.py", line 70, in dumps
**dict(default_kwargs, **kwargs))
File "/usr/lib64/python3.7/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/usr/lib64/python3.7/json/encoder.py", line 199, in encode
@yuehhua
yuehhua / benga.conf
Last active May 29, 2019 02:05
benga.conf: /etc/nginx/sites-enabled/benga.conf, error.log: /var/log/nginx/error.log, ls: ls -al /var/www/benga/static/
server {
listen 80;
listen [::]:80;
server_name 54.210.169.179;
charset utf-8;
root /var/www/benga;
index index.html;
location / {
class Batch(models.Model):
id = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, null=False, auto_created=True)
created = models.DateTimeField(auto_now_add=True)
seq_num = models.SmallIntegerField()
@yuehhua
yuehhua / gist:652904300659bf1903f722c9b8aa7ecf
Created September 3, 2018 15:09
test CSV.jl results in my Julia.
(v1.0) pkg> test CSV
Testing CSV
Resolving package versions...
Installed DecFP ─ v0.4.6
Building DecFP → `~/.julia/packages/DecFP/Mxubh/deps/build.log`
Status `/tmp/tmpMdxENO/Manifest.toml`
[9e28174c] BinDeps v0.8.10
[b99e7846] BinaryProvider v0.4.2
[336ed68f] CSV v0.3.1
[324d7699] CategoricalArrays v0.3.13