Skip to content

Instantly share code, notes, and snippets.

View azriel91's full-sized avatar
🤍
instilling peace

Azriel Hoh azriel91

🤍
instilling peace
View GitHub Profile
@azriel91
azriel91 / bullet-train.zsh-theme
Last active March 17, 2018 00:48
zsh theme, modded to show rust version
# README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
# Terminal.app - it has significantly better color fidelity.

A nice thing to have is a general purpose crate that takes in file paths, errors, line numbers and severity, and number of lines of context to highlight.

The librustc_errors crate in rustc is what emits errors. It's currently tied to rust source. The syntex crate extracts it out, but it is no longer maintained.

@azriel91
azriel91 / .zshrc
Created October 21, 2017 08:18
zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/azriel/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="bullet-train"
@azriel91
azriel91 / ensure_installed_clippy.sh
Last active February 15, 2018 22:07
Ensures that Clippy is installed if using Rust nightly.
#! /bin/sh
# Install Clippy if on nightly
if rustc --version | grep -qF 'nightly'; then
is_clippy_nightly_compatible() {
return $(
cd /tmp
# lightweight crate to lint to test compatibility
empty_crate="empty-$(date +%N)"
@azriel91
azriel91 / xvfb_testing_glutin_on_ci.md
Last active February 23, 2018 00:23
XVFB on Travis, Gitlab CI: NoAvailablePixelFormat error investigation

Symptom:

When using XVFB on Travis CI / Gitlab CI for UI testing, creation of a glutin window fails with NoAvailablePixelFormat:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NoAvailablePixelFormat',

Explanation:

@azriel91
azriel91 / find-rls-preview.sh
Last active September 16, 2018 07:56 — forked from MadratJerry/find-rls-preview.sh
Find the latest rust nightly version with rls-preview
#!/bin/bash
now=`date +%s`
MAC=false
date -r "$now" +%Y-%m-%d &> /dev/null
if [ "$?" -ne "0" ]; then echo "LINUX"; MAC=false; else echo 'MAC'; MAC=true; fi
while true
do
if [ "$MAC" == "true" ]; then data=`date -r "$now" +%Y-%m-%d`; else data=`date -d @"$now" +%Y-%m-%d`; fi
@azriel91
azriel91 / object_configuration_animation.md
Last active October 25, 2018 07:33
Object configuration animation problem

In Amethyst, "animation" does not simply mean visual animation; it means any sort of data that can morph over a certain input value such as time.

When using Amethyst, animation is designed to be done per Component, e.g. we can morph the SpriteRender, or alter the local Transform component. Therefore, if you structure your application's configuration with a different data hierarchy, you should process it into the Component type.

In Will's game configuration, Every object has a series of Sequences, each sequence has a Vec.

#! /bin/bash
# License compatibility
licenses_allowed=(
Apache-2.0
BSD-2-Clause
BSD-3-Clause
BSL-1.0
CC0-1.0
FTL
#! /bin/bash
#
# This is ~~unsafe~~ bash.
#
# Rudimentary automation to update Rust code to use idiomatic 2018.
#
# If you have spaces in your paths, this script will probably not work for you.
#
# Author: azriel
@azriel91
azriel91 / animation_runner.rs
Created March 11, 2019 21:07
AnimationRunner for Amethyst
use amethyst::{
animation::{Animation, AnimationCommand, AnimationControlSet, AnimationSampling, EndControl},
assets::Handle,
};
/// Starts, stops, and swaps animation control sets.
///
/// The animation control sets are generic, so they are not limited to `Material` (texture) animations.
#[derive(Debug)]
pub struct AnimationRunner;