Skip to content

Instantly share code, notes, and snippets.

How to update a borrowck test for MIR borrowck

When we fix a bug in MIR borrowck, we often want to update an existing test and show that it does the same thing for MIR and AST borrowck. This gist describes the steps to do it.

compile-fail tests

An example of a test that has been updated to test both MIR and AST borrowck is borrowck-match-already-borrowed.

@kefir-
kefir- / capture.sh
Created February 26, 2019 22:47
Screen capture with webcam overlay using ffmpeg
ffmpeg -f x11grab -thread_queue_size 64 -video_size 1920x1080 -framerate 30 -i :1 \
-f v4l2 -thread_queue_size 64 -video_size 320x180 -framerate 30 -i /dev/video0 \
-filter_complex 'overlay=main_w-overlay_w:main_h-overlay_h:format=yuv444' \
-vcodec libx264 -preset ultrafast -qp 0 -pix_fmt yuv444p \
video.mkv
@yangxuan8282
yangxuan8282 / compile-mpv-mmal-rpi.md
Last active June 3, 2020 14:23
compile mpv with hardware acceleration (mmal) on RPi, no windows borders

mpv

The latest working mpv version for this guides is 0.27.2, tested on 2018-03-13-raspbian-stretch.

sudo apt-get update && sudo apt-get upgrade -y && 
sudo apt-get install -y git devscripts equivs &&
sudo apt-get install -y libgles2-mesa-dev
@egore
egore / rumble.cpp
Last active December 30, 2020 11:58
SDL 2 based rumble tester I use for PS3 controllers
#include <SDL2/SDL.h>
#include <cstdio>
#include <list>
#include <signal.h>
std::list<std::pair<SDL_Joystick*, SDL_Haptic*>> joysticks;
void shutdown_joysticks() {
SDL_Log("Closing joysticks");
for (std::pair<SDL_Joystick*, SDL_Haptic*> joystick : joysticks) {
@fperez
fperez / nbmerge.py
Created June 23, 2015 01:04
Merge/concatenate multiple IPython notebooks into one.
#!/usr/bin/env python
# Note, updated version of
# https://github.com/ipython/ipython-in-depth/blob/master/tools/nbmerge.py
"""
usage:
python nbmerge.py A.ipynb B.ipynb C.ipynb > merged.ipynb
"""
import io
@titipata
titipata / caffe_install.md
Last active January 27, 2022 03:27
My notes on how to install caffe on Ubuntu

Caffe Installation

Note on how to install caffe on Ubuntu. Sucessfully install using CPU, more information for GPU see this link

###Installation

  • verify all the preinstallation according to CUDA guide e.g.
lspci | grep -i nvidia
@en4rab
en4rab / WiFi-Lightbulb.md
Last active October 30, 2022 14:04
Flashing an unbranded smart lightbulb to Tasmota

Flashing an unbranded smart lightbulb to Tasmota

Whilst on holiday last week I thought i would do something productive but that seemed like work so I bought some cheap noname wi-fi smart LED lighbulbs off ebay and flashed them with Tasmota firmware, since the particular bulb I bought wasnt listed on the Tasmota Device Templates Repository and I have no idea if they accept an entry for a bulb with no identifying marks I thought i'd put something here incase its of use to anyone.

Reliability: I have at this point had 10 of these bulbs running for about a week, one of them has just died.

TL;DR

The pinout and device string for this light:

  • GPIO4 Cold White PWM 4
@eerwitt
eerwitt / load_jpeg_with_tensorflow.py
Created January 31, 2016 05:52
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed
@atupal
atupal / select_input.py
Created June 26, 2013 06:36
Keyboard input with timeout in Python
import sys, select
print "You have ten seconds to answer!"
i, o, e = select.select( [sys.stdin], [], [], 10 )
if (i):
print "You said", sys.stdin.readline().strip()
else:
print "You said nothing!"
@MIvanchev
MIvanchev / article.md
Last active April 4, 2023 13:39
Ever wondered what it takes to run Windows software on ARM? Then this article might be for you!