Skip to content

Instantly share code, notes, and snippets.

@shinyquagsire23
shinyquagsire23 / Linux_building.txt
Last active April 2, 2024 09:19
Monado macOS and Linux Quest Link Build Guide
#
# Installing dependencies (Tested on Ubuntu 22.04 LTS)
#
# Monado
sudo apt install cmake ninja-build
sudo apt install build-essential git wget unzip cmake ninja-build libeigen3-dev curl patch python3 pkg-config libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev ca-certificates libusb-1.0-0-dev libudev-dev libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev libbsd-dev
# XRSP (Quest Link USB)
sudo apt install capnproto libcapnp-dev libx264-dev nlohmann-json3-dev

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt install openjdk-8-jdk-headless

Android SDK

@FreddieSanchez
FreddieSanchez / Graph.scala
Created March 27, 2022 22:10
bfs/dfs implementation of a graph in Scala 3
import scala.annotation.tailrec
class Graph[A](m: Map[A, Set[A]]):
type Vertex = A
type GraphMap = Map[Vertex, Set[Vertex]]
private def neighbors(v: Vertex): List[Vertex] =
m.get(v).map(_.toList).getOrElse(List.empty[Vertex])
def search(start: Vertex, end: Vertex): Boolean =
@tailrec
def bfs(toVisit: List[Vertex], visited: List[Vertex]): Boolean =
@mike-myers-tob
mike-myers-tob / Working GDB on macOS 11.md
Last active January 15, 2024 17:15
Steps to get GDB actually working in April 2021 on macOS (Intel x86-64 only)

Debug with GDB on macOS 11

The big reason to do this is that LLDB has no ability to "follow-fork-mode child", in other words, a multi-process target that doesn't have a single-process mode (or, a bug that only manifests when in multi-process mode) is going to be difficult or impossible to debug, especially if you have to run the target over and over in order to make the bug manifest. If you have a repeatable bug, no big deal, break on the fork from the parent process and attach to the child in a second lldb instance. Otherwise, read on.

Install GDB

Don't make the mistake of thinking you can just brew install gdb. Currently this is version 10.2 and it's mostly broken, with at least two annoying bugs as of April 29th 2021, but the big one is https://sourceware.org/bugzilla/show_bug.cgi?id=24069

$ xcode-select install  # install the XCode command-line tools

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt install openjdk-8-jdk-headless

Android SDK

@sorny
sorny / x11_forwarding_macos_docker.md
Last active April 30, 2024 02:00
X11 forwarding with macOS and Docker

X11 forwarding on macOS and docker

A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY. Works on both Intel and M1 macs!

This guide was tested on:

  • macOS Catalina 10.15.4
  • docker desktop 2.2.0.5 (43884) - stable release
  • XQuartz 2.7.11 (xorg-server 1.18.4)
  • Macbook Pro (Intel)

Install Zsh and Oh-my-zsh on CentOS 7

Based on this article

ALL INSTALLATIONS ASSUME YES WHEN PROMPTED, that's what -y does

This script can be copy paste to ssh as is. No hands installation. :-)

yum install zsh -y
@PeiLi-Sandman
PeiLi-Sandman / ThresholdingAlgo.py
Last active May 17, 2022 15:53 — forked from ximeg/ ThresholdingAlgo.py
Python implementation of smoothed z-score algorithm from http://stackoverflow.com/a/22640362/6029703
# The original version is here: https://gist.github.com/ximeg/587011a65d05f067a29ce9c22894d1d2
# I made several modifications
# Line 14, change to range(lag, len(y))
# Add "addof = 1" for np.std
# For avgFilter and stdFilter, change "filteredY[(i-lag):i]" to "filteredY[(i+1-lag):(i+1)]"
import numpy as np
import pylab
@dlegor
dlegor / ThresholdingAlgo2.py
Created March 7, 2019 03:13
Python implementation of smoothed z-score algorithm version 2, from http://stackoverflow.com/a/22640362/6029703
from numba.decorators import jit
import numpy as np
#The original version is here: https://gist.github.com/ximeg/587011a65d05f067a29ce9c22894d1d2
#I made small changes and used numba to do it faster.
@jit
def thresholding_algo2(y, lag, threshold, influence):
signals = np.zeros(len(y))
filteredY = np.array(y)
@binura-g
binura-g / single-line-cert.sh
Last active May 2, 2024 06:52
Convert Certificates ( .pem, / .crt / etc ) into single-line strings for JSON payloads
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' cert-name.pem