Skip to content

Instantly share code, notes, and snippets.

@tetov
tetov / bootstrap_windows.ps1
Created December 10, 2023 11:52
Bootstrap Windows
# Function to check if a Windows feature is enabled
Function IsFeatureEnabled($featureName) {
$feature = Get-WindowsOptionalFeature -Online -FeatureName $featureName
return $feature.State -eq "Enabled"
}
# Initialize variables to track if a restart is needed
$restartNeeded = $false
# Check and enable WSL feature if not already enabled
# Set environment variable
variables:
CANVAS_COURSE_CODE: 0
# Update this value to the correct course code
default:
tags:
- docker-executor
image: "python:3.9"
before_script:
@tetov
tetov / openpgp.md
Created August 4, 2021 18:58
openpgp.md
@tetov
tetov / utils.py
Last active March 20, 2020 18:08
#################
# Lists and stuff
#################
def remap_values(values, from_domain, to_domain, include_clipped=False):
# TODO: Debug (reverse values compared to remap values in gh)
from_min, from_max = from_domain
to_min, to_max = to_domain
from_range = from_max - from_min
def cgpoint_to_rgpoint(pt): # type: (cg.Point) -> rg.Point3d
"""Convenience function to convert a compas.geometry.Point object to the
corresponding Rhino.Geometry object
Parameters
----------
compas.geometry.Point
Point object to convert
Returns
@tetov
tetov / PKGBUILD
Created November 10, 2019 21:44
Fix for build failure alex js
# Maintainer of this PKGBUILD file: Martino Pilia <martino.pilia@gmail.com>
_name=alex
pkgname=alexjs
pkgver=8.0.0
pkgrel=1
pkgdesc="Catch insensitive, inconsiderate writing"
arch=('any')
url="https://alexjs.com"
license=('MIT')
depends=('nodejs')
@tetov
tetov / Vim.md
Last active April 21, 2019 15:02
"Pull request" to ironpython-stubs.wiki

Vim Setup

Requirements

You need a VIM version that has been with Python 2.7 or later (+python or +python3). You can check this from within VIM using :python3 import sys; print(sys.version) (use :python for Python 2).

Installation

  1. Install jedi-vim (or another autocompletion plugin that supports jedi) either manually or using your preferred plugin manager.
  2. Make sure you do not have other autocomplete plugins loaded.
  3. Make sure you have the autocomplete engine working for the native Python libraries.
@tetov
tetov / copy-gcode.sh
Created February 20, 2019 19:53
Copy gcode to SD card on WSL.
#! /bin/env sh
# run with sudo
SDLETTER=$(echo $1 | tr '[:upper:]' '[:lower:]')
GCODE=$2
SDPATH="/mnt/$SDLETTER/"
GCODEPATH="$PWD/$GCODE"
@tetov
tetov / increment-months.py
Last active October 7, 2019 21:44
To get a monthly recurring date in Swedish format
for n in range (1, 13): print("2019-{:02d}-28".format(n))
@tetov
tetov / fmp-obmc-2018.wch
Created January 3, 2019 19:56
RAM watches for Zelda ALttP TAS used by fmp during OBCM 2018
SystemID SNES
000010 w h 0 WRAM Can do things
00001A b u 0 WRAM Frame count
000020 w h 0 WRAM Y coord
000022 w h 0 WRAM X coord
000024 w h 0 WRAM Z coord
00002A b h 0 WRAM Y subpixel
00002B b h 0 WRAM X subpixel
000030 b s 0 WRAM Y speed
000031 b s 0 WRAM X speed