Skip to content

Instantly share code, notes, and snippets.

Avatar
👷‍♂️
Working from home

Jimmy Moon ragingwind

👷‍♂️
Working from home
View GitHub Profile
@ragingwind
ragingwind / nginx.conf
Created Aug 5, 2019
Redirect old-classic browser including IE 11
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_user_agent $outdated {
default 0;
"~MSIE [1-10]\." 1;
View Using-SVG.markdown
View task-switching.scpt
tell application "System Events"
key down {command}
keystroke {tab}
delay 0.2
key up {command}
end tell
@ragingwind
ragingwind / won-as-backquote.sh
Last active Aug 7, 2021
Backquote binding for won key
View won-as-backquote.sh
mkdir -p ~/Library/KeyBindings &&
echo '{ "₩" = ("insertText:", "`"); }' >> ~/Library/KeyBindings/DefaultkeyBinding.dict
@ragingwind
ragingwind / rgb.cpp
Created May 13, 2021
RGB Class for Modern C++
View rgb.cpp
#include <iostream>
#include <string>
#include <map>
#include <cxxabi.h>
class RGB {
public:
using value_type = std::tuple<unsigned, unsigned, unsigned>;
RGB(unsigned r, unsigned g, unsigned b) : m_r(r), m_g(g), m_b(b) {}
@ragingwind
ragingwind / callstack.ts
Created Oct 21, 2020
Callstack for javascript
View callstack.ts
import { sep } from 'path';
function splitPath(filename, level: number) {
const paths = filename.split(sep);
return paths.splice(paths.length - level).join(sep);
}
export function caller(level: number) {
const oldStackTrace = Error.prepareStackTrace;
try {
@ragingwind
ragingwind / TypedArrayToHeap.js
Last active Aug 17, 2020
Allocate memory with typed array
View TypedArrayToHeap.js
function TypedArrayToHeap(arr) {
const { name, BYTES_PER_ELEMENT } = arr.constructor;
const prefix = name.charAt(0).replace(/I|B/, '');
const heap = Module[`HEAP${prefix}${BYTES_PER_ELEMENT << 3}`];
if (!heap) {
throw new Error(`Unknow typed array ${heap}`);
}
const ptr = Module._malloc(arr.length * BYTES_PER_ELEMENT);
heap.set(arr, ptr / BYTES_PER_ELEMENT);
@ragingwind
ragingwind / index.js
Created Jul 28, 2020
Simple Bridge App for ProtoPie Connect
View index.js
const io = require('socket.io-client');
function main(address, message) {
const socket = io(address);
socket.on('connect', () => {
socket.emit('ppMessage', { messageId: message });
socket.disconnect();
});
}
View notion-page-v3.json
{
"recordMap": {
"block": {
"bc607894-081d-4905-9abf-fae6f9533a44": {
"role": "reader",
"value": {
"id": "bc607894-081d-4905-9abf-fae6f9533a44",
"version": 138,
"type": "page",
"properties": {