Skip to content

Instantly share code, notes, and snippets.

View eswak's full-sized avatar
🚀

Erwan Beauvois eswak

🚀
  • Toulouse, France
View GitHub Profile
@eswak
eswak / offthread.js
Created December 21, 2022 09:10
Easily run a function in a background worker, out of the main UI thread.
function offthread(fn, args, cb) {
var blob = new Blob(
[
'var fn = ' + fn.toString() + ';',
'var ret = fn.call(null, ...' + JSON.stringify(args) + ');',
'postMessage(ret);'
],
{ type: 'text/javascript' }
);
@eswak
eswak / Space Exploration Companies.csv
Last active January 8, 2019 20:22
"New Space" Companies, as of 12/2018.
Name Founded Est. Number of Employees (2016-2018) Country Category Link Description
Ad Astra Rocket Company 2005 30 USA Propulsion http://www.adastrarocket.com Plasma Rocket Propulsion
Alba Orbital 2012 20 UK Smallsat http://www.albaorbital.com/ Smallsat platforms
Altius Space Machines 2010 12 USA LEO Services http://www.altius-space.com/ Developing a tech for RDV with uncooperative satellites
ARCA Space Corporation 1999 400 Romania/USA Launch Services http://www.arcaspace.com/ Space plane
Astrobotic Technology 2008 15 USA Robotics http://www.astrobotic.com/ Selling lunar lander services
Axiom Space 2015 60 USA LEO Services http://axiomspace.com/ Commercial Space Station
Bigelow Aerospace 1999 150 USA Space Tourism http://bigelowaerospace.com/ Modular Space Habitats. Also working on LEO services
Blue Origin 2000 1500 USA Space Tourism https://www.blueorigin.com/ New Shepard : Suborbital tourism ; New Glnn : Reusable LEO launcher
Celestis 1994 USA Space Burial https://www.celestis.com/
@eswak
eswak / install-iota2.md
Created November 24, 2017 23:05
Les commandes à exécuter pour installer la chaîne iota2

Installer la chaîne iota2

le 23/11/2017, j'ai installé la chaîne iota2 sur mon pc. J'ai rencontré quelques difficultés pour connaître l'enchaînement des commandes à éxécuter, et pour compiler la chaîne. Voici les différentes étapes que j'ai suivi pour arriver à mes fins.

Etape 1 : télécharger le code

Le code est disponible sur gitlab : https://framagit.org/inglada/iota2

# se déplacer dans le dossier où on veut mettre la chaîne iota2, puis
# clone (télécharge) le code dans le dossier "./iota2"
git clone https://framagit.org/inglada/iota2.git ./iota2
@eswak
eswak / knapsack-problem.js
Created January 13, 2017 11:08
JavaScript Knapsack problem
// http://rosettacode.org/wiki/Knapsack_problem/0-1
// list all available items
var items = [
{name:"map", weight:9, value: 150},
{name:"compass", weight:13, value: 35},
{name:"water", weight:153, value: 200},
{name:"sandwich", weight: 50, value: 160},
{name:"glucose", weight:15, value: 60},
{name:"tin", weight:68, value: 45},
{name:"banana", weight:27, value: 60},
@eswak
eswak / flattenObj.js
Last active March 4, 2016 09:46
Get a plain object (without nested keys) based on a multi-level object
/*
* Flattens an object by creating a plain object (without nested keys).
* The returned object keys are strings with dots for nested source object.
* Example :
* flattenObj({ a: 1, b: { c: 2, d: null } }) => { 'a': 1, 'b.c': 2, 'b.d': null }
*/
function flattenObj (obj, prefix, acc) {
acc = acc || {};
prefix = prefix || '';
var separator = '.';
@eswak
eswak / str2color.js
Last active February 17, 2016 11:08
JavaScript string to color
function str2num (str) {
var hash = 0, i, chr, len;
if (str == 0) return hash;
for (i = 0, len = str.length; i < len; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0;
}
return hash;
};
@eswak
eswak / origami-ui.html
Created June 19, 2015 12:25
Origami UI
<div class="paper">
<div class="paper-section">
Hello !
</div>
</div>
<div class="paper">
<div class="paper-section">
Hello !
</div>
@eswak
eswak / draw-svg.js
Created February 19, 2015 21:17
Progressively draw SVG to create a hand drawn effect
(function closure () {
// progressively draw each <svg> without .no-draw class
Array.prototype.forEach.call(document.querySelectorAll('svg:not(.no-draw)'), function(svg) {
// animation duration & delay (default values overriden by data attributes)
var animationTimeInSeconds = Number(svg.getAttribute('data-draw-time')) || 2;
var animationStartDelay = Number(svg.getAttribute('data-draw-start-delay'))*1000 || 0;
// init, hide all svgs
var totalFrames = animationTimeInSeconds * 60;
@eswak
eswak / svg-progress-circle.html
Last active August 4, 2016 20:42
SVG Progress circle
<!DOCTYPE html>
<html>
<head>
<style>
svg.progress-circle {
height: 1em;
}
svg.progress-circle text {
fill: #003484;
font-family: 'Roboto', arial;
@eswak
eswak / ogame.user.js
Last active March 31, 2020 14:03
Chrome userscript for ogame UI enhancements
// ==UserScript==
// @match http://*.ogame.gameforge.com/game/*
// @name OGame UI++
// @author Eswak
// @version 1.1.0
// @description Améliore l'interface utilisateur d'OGame en y ajoutant des éléments.
// @icon http://gf1.geo.gfsrv.net/cdn68/20da7e6c416e6cd5f8544a73f588e5.png
// DESCRIPTION :
// This userscript enhances the ogame UI to add some informations into it
// HOW TO INSTALL (GOOGLE CHROME) :