Skip to content

Instantly share code, notes, and snippets.

View robertlugg's full-sized avatar

Robert M Lugg robertlugg

View GitHub Profile
@positlabs
positlabs / LensStudioDebug.js
Last active January 25, 2023 09:41
Script debugging functions for Lens Studio
/*
Include this script at the top of the scene to enable global commands
Usage:
global.showProps(object)
global.showScene(scene)
global.showSceneObject(sceneObject)
global.showComponent(component)
Original by @robertlugg
https://gist.github.com/robertlugg/a5161200998092ddf69cb7393f7efcc0
@tomer
tomer / tee.py
Created April 28, 2021 19:37
Simple `tee` alternative for operating systems without native tee command
import argparse
import sys
from contextlib import ExitStack
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('filename', nargs='*')
parser.add_argument('--append', '-a', action='store_true')
args = parser.parse_args()
@samwyse
samwyse / defer.py
Created October 7, 2020 21:16
Python decorator to emulate Go's defer statement
#! /usr/bin/env python
"""Emulate Go's 'defer' statement.
The defer decorator adds the 'defer' function to the wrapped opject
that will push a callable and its arguments to a stack. The list of
saved calls is executed after the surrounding function returns. Defer
is commonly used to simplify functions that perform various clean-up
actions.
@vsoch
vsoch / Dockerfile
Last active May 15, 2019 07:08
An example multistage Dockerfile to install gvim and then throw the extra stuff away!
FROM ubuntu:18.04 as base
# docker build -t vanessa/vim .
RUN apt-get update && apt-get install -y git \
gcc \
libncurses5-dev \
libncursesw5-dev \
build-essential
@miguelmota
miguelmota / float_format.go
Created December 24, 2018 00:49
Golang float format no trailing zeros
package main
import (
"fmt"
"strconv"
)
func main() {
value := strconv.FormatFloat(10.900, 'f', -1, 64) // 10.9
fmt.Println(value)
@GhostofGoes
GhostofGoes / .gitignore
Created October 4, 2018 04:29
Basic .gitignore template for Python projects
# Editors
.vscode/
.idea/
# Vagrant
.vagrant/
# Mac/OSX
.DS_Store
@akiross
akiross / Convolutional Arithmetic.ipynb
Last active March 12, 2024 16:31
Few experiments on how convolution and transposed convolution (deconvolution) should work in tensorflow.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Vitorbnc
Vitorbnc / stm32_gpio_registers_and_c_bitwise.md
Created August 17, 2016 01:00
How to set bits in C and write to STM32 GPIO registers using Arduino IDE

STM32duino GPIO Registers and Programming

Bit Setting in C

Setting a bit

Use the bitwise OR operator ( | ) to set a bit.

number |= 1 << x;
@kukuruza
kukuruza / gist_cifar10_train.py
Last active March 4, 2021 01:58
Tensorflow: visualize convolutional filters (conv1) in Cifar10 model
from math import sqrt
def put_kernels_on_grid (kernel, pad = 1):
'''Visualize conv. filters as an image (mostly for the 1st layer).
Arranges filters into a grid, with some paddings between adjacent filters.
Args:
kernel: tensor of shape [Y, X, NumChannels, NumKernels]
pad: number of black pixels around each filter (between them)
@miki725
miki725 / .bash_prompt.sh
Last active April 5, 2024 00:04
Custom bash prompt which displays: (virtualenv) user:/path (git-branch)
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.