Skip to content

Instantly share code, notes, and snippets.

@mbaz
mbaz / HamFER.jl
Created Sep 18, 2021
Simple demo of FER improvement using Hamming (7,4) over a BSC
View HamFER.jl
module HamFER
export run
using StaticArrays
const Gt = SA[1 0 0 0 ;
0 1 0 0 ;
0 0 1 0 ;
0 0 0 1 ;
View simple_bf_sim.jl
### A Pluto.jl notebook ###
# v0.14.1
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
View unitvectorviz.jl
### A Pluto.jl notebook ###
# v0.12.11
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
View gnuplotcanvas.html
<!DOCTYPE HTML>
<html>
<head>
<title>Gnuplot Canvas Graph</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
<script src="/usr/share/gnuplot/5.4/js/canvasmath.js"></script>
<script src="/usr/share/gnuplot/5.4/js/gnuplot_common.js"></script>
<script src="/usr/share/gnuplot/5.4/js/gnuplot_dashedlines.js"></script>
<script src="/usr/share/gnuplot/5.4/js/gnuplot_mouse.js"></script>
View plutosvg.jl
### A Pluto.jl notebook ###
# v0.12.4
using Markdown
using InteractiveUtils
# ╔═╡ 32377084-1270-11eb-333d-79b52cc82034
using Gaston
# ╔═╡ 4e73e570-1270-11eb-291a-49f7ae135f50
View gist:2e9ca686ca11329cacce8769451f657f
[~/tmp/TestPage] $ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.2 (2020-05-23)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
View client.jl
# Return a channel to stream `io`. The stream is read
# until a '\n' is found, or until a timeout occurs.
function async_reader(io::IO, timeout_sec)::Channel
ch = Channel(1)
task = @async begin
reader_task = current_task()
function timeout_cb(timer)
put!(ch, :timeout)
Base.throwto(reader_task, InterruptException())
end
View inout.c
#include <stdio.h>
#include <unistd.h>
int main(int argc, char** argv) {
char buf[1];
while (1) {
fread(buf,1,2,stdin);
fprintf(stdout,"This is stdout, echo: %c\n",buf[0]);
fflush(stdout);
if (buf[0] == 'q') break;