Skip to content

Instantly share code, notes, and snippets.

@RobinJadoul
RobinJadoul / README.md
Created January 20, 2023 13:08
HEPL - a simple repl integration for the helix editor
View README.md

HEPL

This is a simple repl integration for the helix editor. It relies on on tmux to show the repl in a separate pane and on jupyter (jupyter-console and whatever jupyter kernels you might like) to run the actual repl.

Features

  • Works with any jupyter kernel
  • Code is dedented to the highest common level, so you can send python code from the middle of a function to the repl too
  • No issues with multiline pieces of code or blank lines inside of a function body, it works as you'd expect it to
@tholden
tholden / NearestKroneckerProduct.m
Last active April 1, 2020 19:08
Matlab Code for finding the nearest Kronecker product to a matrix
View NearestKroneckerProduct.m
function [ B, C, D ] = NearestKroneckerProduct( A, SizeB, SizeC, Hermitian ) %#codegen
% https://doi.org/10.1007/978-94-015-8196-7_17
m = size( A, 1 );
n = size( A, 2 );
m1 = SizeB( 1 );
n1 = SizeB( 2 );
m2 = SizeC( 1 );
n2 = SizeC( 2 );
if nargin < 4
@vihari
vihari / tf_print.py
Last active April 10, 2019 09:06
Tensorflow's tf.Print to stdout instead of default stderr
View tf_print.py
"""
The default tf.Print op goes to STDERR
Use the function below to direct the output to stdout instead
Usage:
> x=tf.ones([1, 2])
> y=tf.zeros([1, 3])
> p = x*x
> p = tf_print(p, [x, y], "hello")
> p.eval()
hello [[ 0. 0.]]
@taylorpaul
taylorpaul / README.md
Last active June 20, 2022 12:53
Tensorboard on SLURM
View README.md

Environment:

Tensorflow: v0.11.0rc2 OS: CENTOS 6.8 (No root access)

Description:

  1. The tensorboardSLURM.sh can be run with the following command to start a tensorboard server on a SLURM cluster:
sbatch --array=0-0 tensorboardSLURM.sh 
@shirriff
shirriff / main.c
Last active July 7, 2021 03:05
Example code using a timer with the BeagleBone Black's PRU microcontroller. This code generates 5 pulses with 100ns width.
View main.c
/*
* Demonstration of the BeagleBone's PRU, using a timer.
* Ken Shirriff, http://righto.com
*/
#include <stdint.h>
#define DELAY_NS 100 // Use 500000000 for 0.5 second delay
#define WRITE_PIN 15 /* P8_11, Ethernet output data, pr1_PRU0_pru_r30_15 */
// PRU Interrupt control registers
@inre
inre / gpio.rs
Created July 31, 2015 20:18
Blink led on raspberry pi 9 (Rust lang)
View gpio.rs
#![feature(core_intrinsics)]
#[warn(dead_code)]
//#[warn(unused_assignments)]
extern crate mmap;
extern crate libc;
use libc::*;
use std::ffi::CString;
use std::path::Path;
use mmap::{MemoryMap,MapOption};