Skip to content

Instantly share code, notes, and snippets.

View pampanelson's full-sized avatar

WangJunKai pampanelson

  • China Shanghai
View GitHub Profile
# https://blender.stackexchange.com/q/57306/3710
bl_info = {
"name": "Add-on Template",
"description": "",
"author": "p2or",
"version": (0, 0, 3),
"blender": (2, 80, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
import bpy
# https://blender.stackexchange.com/questions/5281/blender-sets-compute-device-cuda-but-doesnt-use-it-for-actual-render-on-ec2
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
bpy.context.scene.cycles.device = 'GPU'
bpy.data.scenes["Scene"].render.filepath = "/tmp/output.png"
bpy.ops.render.render(write_still=True)
@pampanelson
pampanelson / blender_cr_headless.md
Created January 17, 2020 00:12 — forked from zocker-160/blender_cr_headless.md
Setup a blender rendernode on a headless server with crowdrender addon

GUIDE: How To create a headless blender renderserver with CrowdRender addon

Requirements

  • any headless linux server
  • Blender v2.79 or v2.80/v2.81a (from package manager or blender.org)
  • latest version of CrowdRender addon
  • optional: GPU drivers for GPU-rendering

install and activate addon

@pampanelson
pampanelson / warp_shadertoy.shader
Created October 15, 2019 02:31 — forked from yumayanagisawa/warp_shadertoy.shader
Shadertoy to Unity (GLSL to HLSL)
Shader "Custom/warp_shadertoy" {
Properties{
/*
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
*/
}
SubShader{
@pampanelson
pampanelson / GLSL-Noise.md
Created August 24, 2019 01:41 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@pampanelson
pampanelson / ctags_autocomplete.py
Created May 6, 2016 02:17 — forked from azagrebin/ctags_autocomplete.py
sublime ctags autocompletion plugin: automatically searches for the .tags file along the current open file path up to the system root
# CTags based autocompletion plugin for Sublime Text 2
# You can add the file to the User Package in ~/Library/Application Support/Sublime Text 2/Packages and restart Sublime Text 2.
# generate the .tags file in some folder along the path of the current open file using "ctags -R -f .tags"
# the script automatically searches for the .tags file along the path up to the system root
# there is no need of any binding to the sublime project folder
import sublime, sublime_plugin, os
def find_ctags(dir):
if not dir:
@pampanelson
pampanelson / rebar-reltool-relase-notes.md
Created April 1, 2016 10:47 — forked from ToddG/rebar-reltool-relase-notes.md
using rebar to create an erlang app with a dependency, and then starting a release created with reltool

Summary

I'm trying to figure out how to use rebar to:

  • create erlang project
  • add a dependency on an erlang module from github
  • start the app via the erl console
  • create a release and start the app from the release (via the generated scripts)
@pampanelson
pampanelson / ctags_autocomplete.py
Created March 25, 2016 09:55 — forked from BlackMac/ctags_autocomplete.py
autocomplete over project for Sublime Text 2
# CTags based autocompletion plugin for Sublime Text 2
# You can add the file to the User Package in ~/Library/Application Support/Sublime Text 2/Packages and restart Sublime Text 2.
# generate the .tags file in your project root with "ctags -R -f .tags"
import sublime, sublime_plugin, os
class AutocompleteAll(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
tags_path = view.window().folders()[0]+"/.tags"
@pampanelson
pampanelson / gist:fc45acc6d25318912f3f
Created January 13, 2016 00:26 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
import UIKit
protocol YelpRequestDelegate {
func getYelpData() -> AnyObject
func processYelpData(data: NSData) -> NSData
}
class YelpAPI {
var delegate: YelpRequestDelegate?