Skip to content

Instantly share code, notes, and snippets.

View inscapist's full-sized avatar

Felx inscapist

  • Penang, Malaysia
View GitHub Profile
let rtcConnection = null;
let rtcLoopbackConnection = null;
let loopbackStream = new MediaStream(); // this is the stream you will read from for actual audio output
const offerOptions = {
offerVideo: true,
offerAudio: true,
offerToReceiveAudio: false,
offerToReceiveVideo: false,
};
@inscapist
inscapist / README.md
Last active August 16, 2021 05:07
Auto mounting a volume to root path (BigSur/Catalina)

Mount volume automatically to root path

Preamble

I create a separate volume for storing my files/codes/dotfiles. Then for every reformat, I just need to symlink my dotfiles to recover my working station.

Edit synthetic.conf

We need to create a directory at root level in order for a volume to mount to.

{
"name": "myapp",
"version": "0.0.1",
"private": true,
"devDependencies": {
"autoprefixer": "^10.3.1",
"cross-env": "^7.0.3",
"cssnano": "^5.0.7",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.6",
@inscapist
inscapist / tailwind.cljs
Last active November 15, 2022 00:36
ChakraUI inspired tailwind *layouts*, in reagent/hiccup
(ns myapp.tailwind
(:require
[clojure.spec.alpha :as s]
[clojure.string :as str]
[vl.config :as config]))
(s/def ::class (s/or :string string? :vector vector?))
(s/def ::cs sequential?) ;; shorthand for classes
(s/def ::dim #{:screen :fill :h :vh :w :vw})
(s/def ::position #{:x-center :y-center :center}) ;; position utils for relative elements
@inscapist
inscapist / notes.md
Last active July 30, 2021 20:34
Cljfmt notes #clojure #clojurescript formatting
@inscapist
inscapist / Dockerfile
Last active June 24, 2021 05:59
Snowpack -> Elixir (Phoenix Framework) -> Mix release + wkhtmltopdf
# ====================================================
# STAGE 1: Snowpack build
FROM node:alpine AS snowpack
WORKDIR /snowpack
# snowpack build
COPY assets ./
# override config
COPY assets/snowpack.config.prod.js ./snowpack.config.js
@inscapist
inscapist / format.patch
Created June 6, 2021 06:28
LSP format fix
diff --git a/modules/editor/format/autoload/format.el b/modules/editor/format/autoload/format.el
index 729ed8779..6565b7c7d 100644
--- a/modules/editor/format/autoload/format.el
+++ b/modules/editor/format/autoload/format.el
@@ -102,7 +102,9 @@ Stolen shamelessly from go-mode"
(defun +format-probe-a (orig-fn)
"Use `+format-with' instead, if it is set.
Prompts for a formatter if universal arg is set."
- (cond ((or buffer-read-only (eq +format-with :none))
+ (cond ((or (eq +format-with :none)
@inscapist
inscapist / flake-direnv.md
Last active June 11, 2024 22:01
Nix Flakes and Direnv on Mac OSX (Catalina)

Development environment with Nix Flakes and Direnv

This document is targeted at those who seek to build reproducible dev environment across machines, OS, and time.

It maybe easier for remote teams to work together and not spending hours each person setting up asdf/pyenv/rbenv, LSP servers, linters, runtime/libs. Nix is probably the closest thing to Docker in terms of development environment.

Flake is used here because it provides hermetic build, with absolutely no reliance on system environment (be it Arch/Catalina/Mojave). Also it freezes dependencies in flake.lock so builds are reproducible.

This gist provides the setup to develop Java/Clojure/Python applications on Nix. But it can be easily adapted to ruby, nodejs, haskell.

@inscapist
inscapist / tsconfig.json
Created May 29, 2021 15:11
Tsconfig.json Boilerplate
{
"compilerOptions": {
"target": "es2019",
"module": "es2015",
"lib": ["dom", "esnext"],
"strict": true,
"outDir": "./src/gen",
"declaration": true
},
"include": ["**/*.ts", "**/*.tsx"],
@inscapist
inscapist / search.jsx
Created May 24, 2021 09:46
Local website search with elastic-lunr and ahocorasick
/* eslint-disable no-undef */
import AhoCorasick from "ahocorasick";
import elasticlunr from "elasticlunr";
import PropTypes from "prop-types";
import queryString from "query-string";
import React, { useState, useEffect } from "react";
import Layout from "../components/layout";
import SEO from "../components/seo";
const SearchContentPage = ({ location }) => {