Skip to content

Instantly share code, notes, and snippets.

View Mark1626's full-sized avatar
👁️
P-4503599627370517

Nimalan Mark1626

👁️
P-4503599627370517
View GitHub Profile
@Mark1626
Mark1626 / complex.fuse
Last active January 11, 2024 07:14
Complex numbers for Dahlia
record complex {
real: float;
imag: float
}
def complex_mul(a: complex, b: complex): complex = {
let cr: float = (a.real * b.real) - (a.imag * b.imag);
let ci: float = (a.real * b.imag) + (a.imag * b.real);
let c: complex = { real=cr; imag=ci };
return c;
\documentclass[sigconf,anonymous=$anonymous$]{acmart}
\usepackage{booktabs}
\usepackage{caption} % http://mirror.easyname.at/ctan/macros/latex/contrib/caption/caption-eng.pdf
\usepackage{balance} % balancing bibstyles as per request in accepted submission
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
@skeeto
skeeto / collide.c
Last active August 31, 2021 15:24
XXTEA block middle collider
/* XXTEA block middle collider
* Usage: $ cc -s -O3 -march=native -fopenmp collide.c && ./a.out
*/
#include <stdint.h>
#include <stdio.h>
#include <time.h>
static void
xxtea128_encrypt(const uint32_t k[4], uint32_t v[4])
{
declare module 'picomatch' {
namespace picomatch {
type ExpandRangeFn = (start: string, end: string) => string;
type FormatFn = (str: string) => string;
type ResultHandler = (result: Result) => void;
interface Result {
glob: string;
regex: RegExp;
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@Aerijo
Aerijo / making_language_grammar.md
Last active March 18, 2024 05:03
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

@kristerw
kristerw / build-gcc-offload-nvptx.sh
Last active July 18, 2024 05:12
Build GCC with support for offloading to NVIDIA GPUs
#!/bin/sh
#
# Build GCC with support for offloading to NVIDIA GPUs.
#
work_dir=$HOME/offload/wrk
install_dir=$HOME/offload/install
# Location of the installed CUDA toolkit
@devster31
devster31 / example.html
Last active June 6, 2024 00:31
Bookmark parser for the NETSCAPE-Bookmark-file-1 format in node. Don't hesitate to comment with feedback.
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<!-- This is an automatically generated file.
It will be read and overwritten.
Do Not Edit! -->
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><A HREF="https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html#//apple_ref/doc/-%20uid/TP40014508" ADD_DATE="1414706885" PRIVATE="0" TAGS="javascript,mac,osx,yosemite">JavaScript for Automation Release Notes</A>
<DD>This article describes JavaScript for Automation, a new feature in OS X Yosemite.
@castaneai
castaneai / hexs-bin-convert.js
Last active September 3, 2019 16:58
converting HexString <-> Uint8Array with javascript
/**
* "1A 2B 3C" のような16進数表記文字列をバイト配列に変換する
*/
$scope.hexs2bytes = function(hexs) {
return hexs.split(' ').map(function(h) { return parseInt(h, 16) });
};
/**
* バイト配列を"1A 2B 3C"のような16進数表記文字列に変換する
*/
@lawliet89
lawliet89 / gist:9677319
Created March 21, 2014 00:54
OpenCL Inline PTX for 256 Bits unsigned addition & multiplication
// Credits: http://goo.gl/NtaADC
// Inline PTX assembly
uint add_asm(uint *result, const uint *a, const uint *b) {
uint carry;
asm("{\n\t"
"add.cc.u32 %0, %9, %17; \n\t"
"addc.cc.u32 %1, %10, %18; \n\t"
"addc.cc.u32 %2, %11, %19; \n\t"
"addc.cc.u32 %3, %12, %20; \n\t"