Skip to content

Instantly share code, notes, and snippets.

Emscripten as a linker for Zig and C

This shows how to build a nontrivial program using Zig+Emscripten or C+Emscripten. In both cases Emscripten is only used as a linker, that is the frontend is either zig or clang.

"Nontrivial" here means the program uses interesting Emscripten features:

  • Asyncify
  • Full GLES3 support
  • GLFW3 support
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 26, 2024 10:58
Complete Recent Discord Quest

Complete Recent Discord Quest

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
  5. Go to the Console tab
  6. Paste the following code and hit enter:
let wpRequire;
  • Based on https://gist.github.com/mdziekon/221bdb597cf32b46c50ffab96dbec08a
  • Installation date: 16-08-2019
  • Additional notes based on my own experience
  • EFI boot
  • Ubuntu 19.04 -> 21.04
  • This should work on any computer. Only the RAID > AHCI change described below and the device name for the nvme ssd drive are specific to this laptop.
  • The process describes a completely fresh installation with complete repartitioning, however it should work fine when Windows is already installed (eg. brand new machine with Windows preinstalled) as long as Windows already boots with EFI.
  • The process was conducted on Dell's XPS 15 9560 (2017) with specs:
  • CPU: i7-7700HQ
@s3rius
s3rius / README.md
Last active April 26, 2024 10:58
Dynamic schedule source for taskiq.

Here's an example of dynamic scheduler for taskiq. It uses postgres to store all tasks.

We created custom schedule source that is capable of storing and retrieving scheduled tasks.

Start workers by running:

taskiq worker tkq:broker --fs-discover
#!/bin/bash
set -eu
_UID=$(id -u)
GID=$(id -g)
# give lxd permission to map your user/group id through
grep root:$_UID:1 /etc/subuid -qs || sudo usermod --add-subuids ${_UID}-${_UID} --add-subgids ${GID}-${GID} root
# set up a separate key to make sure we can log in automatically via ssh
# with $HOME mounted
// ==UserScript==
// @name Youtube Playlist Cleanser
// @version 2.1.0
// @description Removes watched videos from playlist either by %watched or all
// @author js6pak
// @include http*://*.youtube.com/*
// @include http*://youtube.com/*
// @run-at document-idle
// @homepageURL https://gist.github.com/js6pak/33bdefdefac09c387f55d08c5b9526fa
// @downloadURL https://gist.github.com/js6pak/33bdefdefac09c387f55d08c5b9526fa/raw/youtube-playlist-cleanser.user.js
@ismet55555
ismet55555 / tmux-install-upgrade.sh
Last active April 26, 2024 10:53
Install or Upgrade tmux
#!/bin/bash
set -o errexit
#################################################################
# Install/Upgrade tmux
#################################################################
#
# This script installs or updates tmux onto a Debian (ie Ubuntu),
# CentOS/RHEL, or MacOS platform. This script is based on:
@edonosotti
edonosotti / chatbase-howto.js
Last active April 26, 2024 10:51
How to integrate chatbase in a chatbot project.
# Integrating Chatbase in your chatbot - Node.JS version
#
# The purpose of this code is to show how to integrate the Chatbase service in any chatbot.
#
# See my article on Chatbots Magazine for details:
# https://chatbotsmagazine.com/advanced-chatbot-analytics-and-sentiment-analysis-part-1-17a8e674d7e1
#
# License: MIT (https://opensource.org/licenses/MIT) (C) Edoardo Nosotti, 2017
const chatbase = require('@google/chatbase');
@hadware
hadware / bytes_to_wav.py
Last active April 26, 2024 10:50
Convert wav in bytes for to numpy ndarray, then back to bytes
from scipy.io.wavfile import read, write
import io
## This may look a bit intricate/useless, considering the fact that scipy's read() and write() function already return a
## numpy ndarray, but the BytesIO "hack" may be useful in case you get the wav not through a file, but trough some websocket or
## HTTP Post request. This should obviously work with any other sound format, as long as you have the proper decoding function
with open("input_wav.wav", "rb") as wavfile:
input_wav = wavfile.read()