Skip to content

Instantly share code, notes, and snippets.

View jmbarbier's full-sized avatar

Jean-Matthieu BARBIER jmbarbier

View GitHub Profile
@jmbarbier
jmbarbier / cubique-simple.jscad
Last active October 6, 2023 04:58
Cubique simple jscad
// Cubique simple
const jscad = require('@jscad/modeling')
const {cube, sphere} = jscad.primitives
const {translate} = jscad.transforms
const {union, intersect} = jscad.booleans
const getParameterDefinitions = () => {
return [
{ name: 'a', type: 'int', initial: 200, caption: 'Parametre de maille (2R) en 1/10 mm ?' },
@jmbarbier
jmbarbier / hexagonal-compact.jscad
Last active October 15, 2023 05:23
Hexagonal compact jscad
// Hexagonal compact
const jscad = require('@jscad/modeling')
const {cube, sphere, polygon} = jscad.primitives
const {translate, rotate} = jscad.transforms
const {union, intersect} = jscad.booleans
const {colorize} = jscad.colors
const {sqrt} = Math
const {extrudeLinear} = jscad.extrusions
const {degToRad} = jscad.utils
// Cubique faces centrées
const jscad = require('@jscad/modeling')
const {cuboid, sphere, polygon} = jscad.primitives
const {translate, rotate} = jscad.transforms
const {union, intersect} = jscad.booleans
const {colorize} = jscad.colors
const {sqrt} = Math
const {extrudeLinear} = jscad.extrusions
const {degToRad} = jscad.utils
@jmbarbier
jmbarbier / cubique-centre.jscad
Last active October 15, 2023 06:21
Cubique centré jscad
// Cubique centré
const jscad = require('@jscad/modeling')
const {cuboid, sphere, polygon} = jscad.primitives
const {translate, rotate} = jscad.transforms
const {union, intersect} = jscad.booleans
const {colorize} = jscad.colors
const {sqrt} = Math
const {extrudeLinear} = jscad.extrusions
const {degToRad} = jscad.utils
@jmbarbier
jmbarbier / HTML2PDF.pl
Created March 15, 2018 01:30 — forked from PhilterPaper/HTML2PDF.pl
Wrapper to add page numbers to TOC and links for wkhtmltopdf processing
# wrapper for wkhtmltopdf and pdftk to update links with actual page numbers
# TOC entries get leader dots and page number . . . NN
# internal links (#id) get [page NN]
# written by Phil M Perry
# (c) copyright 2015, Phil M Perry
# license: GNU Lesser General Public License (LGPL) v3
#
use warnings;
# it's a quick & dirty job that doesn't have many safeguards. use at your own
# risk. anyone is welcome to improve upon it!
@jmbarbier
jmbarbier / bkpuntracked.sh
Created April 6, 2017 21:05
Saving all untracked files from a git repository
git ls-files --others \
| grep -v .DS_Store \
| grep -v .htaccess \
| grep -v .git \
| tr '\n' '\0' \
| xargs -0 -n1 -I '{}' rsync -aP '{}' user@dest:/tmp/nongit
@jmbarbier
jmbarbier / testcase.sh
Last active January 18, 2016 01:26
Gandi systemd / docker failure at reboot testcase.
#!/bin/bash
# Test restart d'une VM sur instance de base Gandi Debian 8 + install par défaut de docker
VM=dockersystemd
gandi vm create --datacenter LU --memory 1024 --cores 2 --ip-version 4 --hostname $VM --image "Debian 8 64 bits (HVM)" --size 10G
echo "Installing docker"
gandi vm ssh $VM 'apt-get update && apt-get install -y curl'
gandi vm ssh $VM 'curl -sSL https://get.docker.com/ | sh'
@jmbarbier
jmbarbier / zfs-snapshot.sh
Created September 25, 2015 11:52
Create zfs snapshots - not from me :)
#!/bin/bash
##
# original code: http://andyleonard.com/2010/04/07/automatic-zfs-snapshot-rotation-on-freebsd/
# 07/17/2011 - ertug: made it compatible with zfs-fuse which doesn't have .zfs directories
##
# Path to ZFS executable:
ZFS=/sbin/zfs
@jmbarbier
jmbarbier / README.gandi.md
Last active October 14, 2015 00:34
"Automatisation" de la formation d'un cloud de CoreOS chez #Gandi...

Lancement "auto" d'un cloud CoreOS chez Gandi

  • gandi cli configuré et prêt à lancer des machines
  • git clone ce gist
  • préparer un discoveryToken sur https://discovery.etcd.io/new?size=1
  • éditer gandi_coreos_test.sh selon besoins (nb instances, noms, ...)

TODO

  • être + efficace (cloner un modèle au lieu de recréer, etc..)
@jmbarbier
jmbarbier / nginx.conf
Last active August 29, 2015 14:13 — forked from thoop/nginx.conf
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;