Skip to content

Instantly share code, notes, and snippets.

@sylvainbx
sylvainbx / FCInfo_fr_Ver_1-29-rmu_Docked.FCMacro
Last active May 10, 2024 21:58 — forked from mario52a/FCInfo_fr_Ver_1-29b-rmu_Docked.FCMacro
Donne une série de renseignements sur la forme sélectionnée et peut afficher une conversion de la longueur, de l'inclinaison de la forme (degrés, radian, grade, pourcent), de la surface, du volume et du poids de la forme dans la densité sélectionnée dans différentes unités de grandeurs internationales et anglo-saxonnes. (Version Française)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
* Copyright (c) <mario52> 2014 2015 2016 2017 2018 2019 2020 2021 2022 *
* 2023 *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
@sylvainbx
sylvainbx / file-list-helper.ts
Created December 1, 2022 08:34
Typescript: Mock a FileList for unit testing purposes.
interface FileListHelper {
empty: () => globalThis.FileList,
fromFiles: (files: File[]) => globalThis.FileList
}
class FileList {
private readonly files: File[];
public length: number;
constructor (files?: File[]) {
this.files = files || [];
@sylvainbx
sylvainbx / update
Last active June 26, 2023 12:40
Archlinux update script, to paste in /usr/bin and chmod u+x
#!/bin/bash
getopts 'y' YES
sudo paccache -rk1
sudo paccache -ruk0
sudo pacman -Sy archlinux-keyring && sudo pacman -Su
sudo pacman -Syu
[[ "$YES" = "y" ]] && aur="y" || read -rp "Proceed with AUR update? (y/N) " aur </dev/tty
if [[ "$aur" = "y" ]]; then
@sylvainbx
sylvainbx / coffeetojs.pl
Last active November 19, 2018 14:25
Convert JSdoc comments from coffeescript to javascript
#!/usr/bin/perl
use strict;
use warnings;
my $file = shift @ARGV;
# open (read) file from command line argument
open(my $jsfile, '<', $file) or die "Can't read file '$file' [$!]\n";
# undef the line separator ($/) for this script, to grab the whole file
local $/;
# read file
@sylvainbx
sylvainbx / elasticsearch17.asc
Created March 28, 2018 14:48
ElasticSearch 1.7 package repository public key (debian)
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQINBFRvqBkBEADAe63Jl0pw5Ry9LDwn31BJSBat+2WYJXT4Iqsgtmm79drvAcVU
JjtGZX11XdJj/aIVxeafghYxVj4Ld+yxiB25GAcxGr5O3Acv7DOlBQnqFZ7jvZUd
qwSCpsoDoBt5rX+FlHl/NB8VGjpS0cgC+wuSrLRW6Qux0/tn2Dow7KzB5B7YvaCi
ChF2M7ZPJhhp5QGoI+ucEwSJ/NIeOguZWiOEl+Tbglz5YTHuVjZViNIX4Xdw+N7l
1//oR8k/GEWuVU4dFsWmc6UCEClCotYHXoPHHGJpIUDBMk3sU5v3ULjKcIDkHOHX
qu91lk9OEdteieWS6npsuyy2pOOgRgXKxi1mAc7jPTLejT2GTCoUl6anP6/MbMdC
uMww1TadVaVTnw7zxW0t/uQ97wr1YtwnB6mLdfgCbUTtXMoFdijGJx+k/qb4cmmr
@sylvainbx
sylvainbx / TextEditor.jsx
Last active December 9, 2022 03:17
React wysiwyg text editor
import React, { Component, PropTypes } from 'react';
import {
bold,
italic,
underline,
strikethrough,
superscript,
subscript,
unordered,
ordered,
@sylvainbx
sylvainbx / seeds.rb
Created December 8, 2016 11:01
fab-manager fixes #55
if StatisticCustomAggregation.count == 0
# available reservations hours for machines
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)
available_hours = StatisticCustomAggregation.new({
statistic_type_id: machine_hours.id,
es_index: 'fablab',
es_type: 'availabilities',
field: 'available_hours',