Skip to content

Instantly share code, notes, and snippets.

import Controller from '@ember/controller';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@service router;
@action async transition(route) {
try {
@KoKuToru
KoKuToru / variant.cpp
Last active August 19, 2021 20:03
C++ Variant
//#include <iostream>
#include <type_traits>
#include <string>
#include <stdexcept>
#define FLATTEN __attribute__((flatten))
#define INLINE __attribute__((always_inline))
#define INLINE_FLATTEN __attribute__((always_inline, flatten))
using size_t = std::size_t;
@KoKuToru
KoKuToru / utf8_utf16.cpp
Created May 1, 2022 14:22
Convert UTF8 to UTF16
#include <string>
#include <string_view>
#include <iostream>
#include <tuple>
std::tuple<std::u8string_view, char32_t> decode_u8_charpoint(std::u8string_view input) {
// XXX: silently accept invalid UTF8
if ((input.at(0) & 0b10000000) == 0b00000000) {
return {
input.substr(1),
@KoKuToru
KoKuToru / file_fixer.cpp
Last active May 12, 2022 17:56
File Fixer
// g++ file_fixer.cpp --std=c++20 -O3 -o file_fixer
// usage: ./file_fixer file_to_fix file_ref_a file_ref_b ....
#include <string_view>
#include <iostream>
#include <span>
#include <vector>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
@KoKuToru
KoKuToru / make.sh
Last active November 1, 2025 09:22
steam in systemd-nspawn on archlinux (only for intel/amd gpu)
#!/bin/bash
# based on https://liolok.com/containerize-steam-with-systemd-nspawn/
if [ "$EUID" -ne 0 ]; then
echo "Not running as root. Please run with sudo."
exit 1
fi
set -ex
container_name=steam-container