Skip to content

Instantly share code, notes, and snippets.

View hackeris's full-sized avatar

hackeris hackeris

  • Shanghai
View GitHub Profile
@Ruminat
Ruminat / groovy-language-definition-for-monaco.ts
Created February 5, 2022 12:32
A Groovy language for monaco editor
import { languages } from "monaco-editor";
function getTokens(tokens: string, divider = "|"): string[] {
return tokens.split(divider);
}
const wordPattern = /(-?\d*\.\d\w*)|([^`~!@#%^&*()\-=+[{\]}\\|;:'",./?\s]+)/g;
const brackets: languages.CharacterPair[] = [
["{", "}"],
@th0rex
th0rex / Usage.md
Last active July 23, 2025 14:43
Build qemu as a library

Place file into qemu root directory Do cd path/to/qemu && ./name_of_file name_of_target (i.e. x86_64-softmmu) Library is at /path/to/qemu/x86_64-softmmu/libqemu.so You might need to compile vl.c and link with it in your final binary, just do something like this:

#define main __definetly_not_main
#include "/path/to/qemu/vl.c"
#undef main
@0
0 / bluetooth_serial.md
Last active March 16, 2025 19:32
Connecting a Bluetooth device for serial communication on Arch Linux.

The following are instructions for connecting a Bluetooth device for serial communication on Arch Linux using BlueZ 5.31.

Prerequisites

The following packages are required:

  • bluez: bluetoothd
  • bluez-utils: bluetoothctl, rfcomm
@typehorror
typehorror / Flask-SQLAlchemy Caching.md
Last active February 15, 2024 14:44
Flask SQLAlchemy Caching

Flask-SQLAlchemy Caching

The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.

Usage

retrieve one object

# pulling one User object

user = User.query.get(1)

@DieHertz
DieHertz / any.h
Last active August 9, 2017 11:45
#ifndef any_h
#define any_h
namespace utility {
class any {
struct impl_base {
virtual impl_base* clone() const = 0;
virtual ~impl_base() = default;
};
@DieHertz
DieHertz / typelist.cpp
Created January 14, 2014 12:02
C++11 typelists
struct NullType {};
template <typename T, typename U>
struct TypeList {
using Head = T;
using Tail = U;
};
template <typename...> struct MakeTypeList;
@alexandruc
alexandruc / socket_client.cpp
Created April 10, 2012 12:13
Unix domain sockets example
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/types.h>
static const char* socket_path = "/home/mysocket";
static const unsigned int s_recv_len = 200;
static const unsigned int s_send_len = 100;