Skip to content

Instantly share code, notes, and snippets.

@remram44
remram44 / heightmap.gd
Last active January 19, 2019 00:39
Heightmap script for the Godot game engine
tool
extends MeshInstance
export(Image) var heightmap setget set_heightmap, get_heightmap
export(float, 0.1, 25, 0.1) var factor = 5 setget set_factor, get_factor
export(int, 1, 500) var resolution = 32 setget set_resolution, get_resolution
export(int, 1, 200) var size = 50 setget set_size, get_size
var mesh_builder
@remram44
remram44 / api_example.py
Created July 6, 2016 22:01 — forked from rexissimus/api_example.py
api scripting example
import vistrails.core.api as API
from vistrails.core.modules.basic_modules import create_constant
org_vistrails_vistrails_vtk = API.load_package('org.vistrails.vistrails.vtk')
org_vistrails_vistrails_vtk_2 = API.load_package('org.vistrails.vistrails.vtk')
import requests
org_vistrails_vistrails_vtk_3 = API.load_package('org.vistrails.vistrails.vtk')
org_vistrails_vistrails_vtk_4 = API.load_package('org.vistrails.vistrails.vtk')
import vtk
org_vistrails_vistrails_vtk_5 = API.load_package('org.vistrails.vistrails.vtk')
from vistrails.core.modules.vistrails_module import ModuleConnector
@remram44
remram44 / lib.rs
Created October 24, 2015 17:55
Rust generic function
extern crate num;
use num::{Num, One, Zero};
pub fn number_of_factors<T>(target: T) -> T
where T: Num + Ord + Copy
{
let mut factor_count: T = Zero::zero();;
let mut limit: T = target;
let mut i: T = One::one();
def draw_line(pixels, origin, destination):
x, y = x1, y1 = origin
x2, y2 = destination
Δx = abs(x2 - x1)
Δy = abs(y2 - y1)
s1 = sign(x2-x1)
s2 = sign(y2-y1)
@remram44
remram44 / https.py
Created April 16, 2014 21:35 — forked from schlamar/gist:2993700
Secure usage of urllib2; default doesn't check SSL certificates at all
# Python's handling of certificate verification is irresponsible and wrong.
# Having to include the code below to get what should be the only acceptable
# default behavior is a shame
# Code from https://gist.github.com/schlamar/2993700
import httplib
import urllib2
import ssl
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@remram44
remram44 / sparks.py
Last active December 18, 2015 14:49 — forked from stefanv/sparks.py
#!/usr/bin/python
# coding=utf-8
# Python version of Zach Holman's "spark"
# https://github.com/holman/spark
# by Stefan van der Walt <stefan@sun.ac.za>
"""
USAGE: