Skip to content

Instantly share code, notes, and snippets.

View Utopiah's full-sized avatar

Fabien Benetou Utopiah

View GitHub Profile
@Utopiah
Utopiah / .block
Last active October 17, 2016 00:17
Interactive dataviz for VR
license: mit
@Utopiah
Utopiah / EthereumContractExploration.js
Created November 6, 2016 18:28
Exploring smart contract with a web interface using Ethereum and solidity for the Blockchain workshop at iMAL
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
} else {
// set the provider you want from Web3.providers
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}
//console.log(web3); // {eth: .., shh: ...} // it's here!
@Utopiah
Utopiah / triangulate_obj.py
Last active October 18, 2022 09:36
Blender Python script to triangulate obj coming from Google Blocks
# Blender Python script to triangulate obj coming from Google Blocks
# result http://vatelier.net/MyDemo/TestingTriangulation/
# via https://blender.stackexchange.com/questions/34537/how-to-batch-convert-between-file-formats
import bpy # Python interface for Blender, use Shift+F4 to start the interactive console.
# alternatively for headless server side batch conversion use blender -b -P triangulate_obj.py
import os
def convert_in_dir(path):
for root, dirs, files in os.walk(path):
for f in files:
@Utopiah
Utopiah / ShadingInBlender.py
Created August 10, 2017 09:31
Shading in Blender
import bpy
ob = bpy.context.object # get the active object
mesh = ob.data
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
for space in area.spaces:
if space.type == 'VIEW_3D':
space.viewport_shade = 'MATERIAL'
bpy.context.scene.game_settings.material_mode = 'GLSL'
@Utopiah
Utopiah / AFrameExporterScript.py
Last active September 3, 2022 13:31
from Blender to WebVR in 1 click
'''
from Blender to WebVR in 1 click (warning: you need your own backend but a 1 php file is enough)
demo https://www.youtube.com/watch?v=PD1qTKp5DZ4
improvments
JS traverser to start/stop animations and change morph target values
render as 360 rather than mesh, either as an option and/or beyond a threshold
for addon proper https://docs.blender.org/manual/en/dev/advanced/scripting/addon_tutorial.html
@Utopiah
Utopiah / OfflineImmersiveRenderingAsBrowsable360Images.py
Last active August 11, 2017 17:05
360 map for offline rendering of an existing heavy scene
# 360 map for offline rendering of an existing heavy scene
"""
example of player https://vatelier.net/MyDemo/Browsable360s/
improvement
- have an example WITHOUT a mesh in the middle creating a black screen, duh
- fading in/out with a bit of virtual camera movement for target loading
- stero renders
[Port 14] Generic SuperSpeed USB Hub
[Port 1] USB Composite Device
HoloLens Sensors
USB Input Device
HID-compliant device
HID-compliant device
HoloLens Sensors
Samsung Windows Mixed Reality 800ZAA
Select filter to monitor (q to quit): 14
Invalid input
@Utopiah
Utopiah / Firefox_PDFjs_reader_autoscroll.js
Last active October 9, 2023 13:35
Firefox PDF.js reader autoscroll shorcuts
// use the s shortcut to toggle autoscroll
var as; document.onkeyup = function(e) {
if(e.key == "s"){
if (!as) {
as = setInterval( () => { document.querySelector("#viewerContainer").scrollBy(0, 1) } , 100 );
// for a normal page use window.scrollBy instead
} else {
clearInterval(as); as = null; scrolling = false;
}
}
@Utopiah
Utopiah / No Porn PirateBay Top100 48hrs
Created March 3, 2019 07:52
1 liner to remove adult content from the PirateBay top 100 of the last 48hrs
for(var el of document.querySelectorAll('a[href$="500"]')){el.parentElement.parentElement.parentElement.style.display="none"}
@Utopiah
Utopiah / glitch_backup.js
Created March 25, 2019 20:31
Download all your Glitch projects
// cf https://support.glitch.com/t/exporting-all-projects/9367/2
const fetch = require('node-fetch');
const wget = require('node-wget');
// cf localStorage.cachedUser in Glitch editor
var OWNER_TOKEN = "xxxx-yyyy-zzzzz-aaaa-bbbbb"
var USER_ID = "123456"
var PROJECT_ID = ""
var urlAllProjects = `https://api.glitch.com/users/${USER_ID}?authorization=${OWNER_TOKEN}`