Skip to content

Instantly share code, notes, and snippets.

View cyrildiagne's full-sized avatar

Cyril Diagne cyrildiagne

View GitHub Profile
@cyrildiagne
cyrildiagne / setup_knative_gcp.sh
Last active July 4, 2023 05:08
Setup Knative Cluster with GPU on GKE
#!/bin/bash
# Requires gcloud and kubectl.
# Make sure you've enabled the API services using gcloud:
# gcloud services enable \
# cloudapis.googleapis.com \
# container.googleapis.com \
# containerregistry.googleapis.com
# Exit on error.
@cyrildiagne
cyrildiagne / cleanup_worker.sh
Last active June 5, 2018 07:50
Kubernetes cluster with KubeADM
sudo kubeadm reset
sudo curl -L git.io/weave -o /usr/local/bin/weave
sudo chmod a+x /usr/local/bin/weave
sudo weave reset
rm ~/.kube/config
sudo systemctl restart docker
# Run as: blender -b <filename> -P <this_script> -- <image_path>
import bpy, sys, os
from random import random
# Assume the last argument is image path
output_folder = sys.argv[-1]
for i in range(806, 1000):
vase = bpy.data.objects["vase"]
scene = bpy.data.scenes['Scene']
@cyrildiagne
cyrildiagne / setup_atom.sh
Last active April 26, 2017 07:08
Setup Atom
brew install clang-format
apm install clang-format
# Atom settings > clang-format settings > set "Fallback Style" to "Google"
# Atom settings > clang-format settings > set "Format on save"
npm install -g eslint eslint-config-google
apm install linter linter-ui-default linter-eslint
# Atom settings > linter-eslint settings > enable "Use global ESLint installation"
# Add file named '.eslintrc.json' at root of project:
# { "extends": "google", "parserOptions": { "ecmaVersion": 6 }, "rules": {}}
@cyrildiagne
cyrildiagne / photoresistor_to_tune.ino
Created February 28, 2016 13:48
Arduino - Photoresistor to Tune
#include "pitches.h"
int lightPin = 0;
int potPin = 1;
int valueToTriggerNote = 0;
int tunePin = 9;
int feedbackLedPin = 13;
int tune = 400;
# adds collection names in metadatas jsons.
import csv
import os
import json
from Tkinter import Tk
import tkFileDialog
import io
collectionsFileName = "allCollectionNames.csv"
@cyrildiagne
cyrildiagne / nodeWemoToggle.js
Created November 16, 2015 22:00
Belkin Wemo toggle using Node.js
var value = process.argv[2];
if (typeof value == "undefined") {
console.log('usage : node toggleWemo [0:1]');
process.exit(1);
}
var http = require('http-debug').http;
http.debug = 2;
var wemoIP = '172.20.10.2';
@cyrildiagne
cyrildiagne / exercice.js
Created September 19, 2015 15:28
Simple nodejs script that uses RobotJS
// importe la librairie robotjs
var robot = require("robotjs");
// défini les variables des vitesses horizontale & verticale
var speedX = 15;
var speedY = 5;
// créé une fonction update() qui sera appelée indéfiniment (voir ligne 37)
function update() {
@cyrildiagne
cyrildiagne / lightline_enclosure.scad
Created December 31, 2014 13:12
light line enclosure
circuitLength = 66;
circuitClipHeight = 7;
circuitOffset = 4;
module xhole(radius, length) {
rotate(a=[0,90,0]) cylinder(r=radius,h=length+1,center=true, $fn=10);
}
module batteryClip(width, length, thickness) {
union() {
@cyrildiagne
cyrildiagne / lightline.ino
Created December 10, 2014 11:30
LightLine Kit Arduino Firmware v1
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h>
//SoftwareSerial softSerial(8, 9); // RX, TX
#define BUFFER_SIZE 256
char input[BUFFER_SIZE];
int currPos = 0;