Skip to content

Instantly share code, notes, and snippets.

View Fonger's full-sized avatar

Fonger Fonger

  • Taipei, Taiwan
  • 18:17 (UTC +08:00)
View GitHub Profile
@Fonger
Fonger / lirc_raw_signal.js
Last active July 3, 2019 11:36
Sending IR Pulse with LIRC in node.js without d.conf file
/*
Copyright (c) 2019 Fonger https://github.com/Fonger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@vkarpov15
vkarpov15 / socketreporter.js
Created June 29, 2019 15:57
Example of reporting on progress using an async generator function and websockets
const WebSocket = require('ws');
// Core solver logic, stubbed out for example
async function* slow() {
yield 'starting...';
await new Promise(resolve => setTimeout(resolve, 10 * 1000));
// Use `yield` to report on progress
yield 'loading data...';
await new Promise(resolve => setTimeout(resolve, 10 * 1000));
@hutattedonmyarm
hutattedonmyarm / RungapGPX.py
Last active October 17, 2023 08:48
Rungap for iOS exports GPS data as JSON file in the free version. This script converts it to GPX. Tested with python3.6. Might need to install required modules. Simply place either the metadata and data json files, or the complete zip file in the same directoryas the script and run it. Warning: Does barely any error checking
import xml.etree.cElementTree as ElementTree
import json, pytz, zipfile, unicodedata, re
from datetime import datetime
from os import listdir
from os.path import isfile, join
import glob
def slugify(value):
"""
Normalizes string, converts to lowercase, removes non-alpha characters.
@Fonger
Fonger / VMProtectSDK64.inc
Last active January 3, 2018 12:26
VMProtect 64 bit masm header file for MASM for x64(ml64.exe) on Visual Studio
; protection
VMProtectBegin PROTO :DWORD
VMProtectBeginVirtualization PROTO :DWORD
VMProtectBeginMutation PROTO :DWORD
VMProtectBeginUltra PROTO :DWORD
VMProtectBeginVirtualizationLockByKey PROTO :DWORD
VMProtectBeginUltraLockByKey PROTO :DWORD
VMProtectEnd PROTO
; utils
@koorchik
koorchik / ast vs rpn.js
Last active July 6, 2023 09:27
Compare AST and RPN evaluation performance
/*
There is an AST (Abstract syntax tree) in JSON format.
AST represents Excel spreadsheet formula.
Is it possible in JavaScript to make RPN (Reverse Polish Notation) faster than AST?
AST evaluation is recusive and RPN evaluation is iterative.
But in any case, AST evaluation is faster despite recursion.
I guess that the main problem is in using dynamic js arrays to emulate stack.
Would RPN win if it was written in C/C++?
@mcxiaoke
mcxiaoke / index.html
Created July 3, 2014 03:53 — forked from davidwkeith/index.html
detect app installed in browser
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!-- iframe used for attempting to load a custom protocol -->
<iframe style="display:none" height="0" width="0" id="loader"></iframe>
@jboner
jboner / latency.txt
Last active December 21, 2024 21:53
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD