Skip to content

Instantly share code, notes, and snippets.

View AloyASen's full-sized avatar
💭
working remotely

Aloy Aditya Sen AloyASen

💭
working remotely
View GitHub Profile
<!--
-->
<html>
<head>
<title>WebGL Demo</title>
<meta charset="utf-8">
<script src="./js/build/Three.js" type="text/javascript"></script>
<script src="./js/js/RequestAnimationFrame.js" type="text/javascript"></script>
<script src="./js/js/Stats.js" type="text/javascript"></script>
@TooTallNate
TooTallNate / ffi_closure_alloc_test.c
Created January 7, 2012 20:12
The example from the libffi docs for how to use `ffi_closure` with `ffi_closure_alloc()` and `ffi_closure_free()`.
#include <stdio.h>
#include <ffi.h>
/* Acts like puts with the file given at time of enclosure. */
void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
FILE *stream)
{
*ret = fputs(*(char **)args[0], stream);
}
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@Smerity
Smerity / fetch_page.py
Created August 7, 2015 21:30
An example of fetching a page from Common Crawl using the Common Crawl Index
import gzip
import json
import requests
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
# Let's fetch the Common Crawl FAQ using the CC index
resp = requests.get('http://index.commoncrawl.org/CC-MAIN-2015-27-index?url=http%3A%2F%2Fcommoncrawl.org%2Ffaqs%2F&output=json')
@deathcap
deathcap / ls.js
Last active August 25, 2022 18:11
example of transpiling FreeBSD bin/ls/ls.c to JS using https://github.com/deathcap/transpile-c-to-js
function xo_emit_hvp(xop, fmt, vap)
{
return xo_emit_hv(xop, fmt, vap);
}
function xo_emit_hp(xop, fmt, ...args)
{
let vap;
__builtin_va_start(vap);
let rc = xo_emit_hv(xop, fmt, vap);
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active November 3, 2024 22:54
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@markerikson
markerikson / redux-thunk-examples.js
Last active June 28, 2024 05:30
Redux-Thunk examples
// The classic AJAX call - dispatch before the request, and after it comes back
function myThunkActionCreator(someValue) {
return (dispatch, getState) => {
dispatch({type : "REQUEST_STARTED"});
myAjaxLib.post("/someEndpoint", {data : someValue})
.then(
response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}),
error => dispatch({type : "REQUEST_FAILED", error : error})
);
@zenorocha
zenorocha / basic.md
Last active March 26, 2023 09:00
New Firebase Auth vs Old Firebase Auth
@mtvee
mtvee / main.cpp
Last active August 6, 2024 03:29
cross platform socket example c/c++
#include<cstdio>
#include<cstring>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include<unistd.h>
@csullivan
csullivan / cereal_polymorphic_serialization.cc
Last active April 9, 2023 23:27
polymorphic data serialization example with cereal
#include <iostream>
#include <vector>
#include <memory>
#include <cereal/archives/binary.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/types/string.hpp>
#include <cereal/types/base_class.hpp>
#include <cereal/types/memory.hpp>
#include <cereal/access.hpp>