Skip to content

Instantly share code, notes, and snippets.

@larry1001
larry1001 / fetch_weibo.js
Created March 7, 2019 02:08
puppeteer 抓取新浪微博
const puppeteer = require("puppeteer");
const qs = require('querystringify');
const userName = "XXXX";
const passWord = "XXXX";
const sleep = require("./utils").sleep;
const log = require('log4js').getLogger("weibo");
const weiboconfig = require("./config").weibo;
log.level = 'info';
const index = async function (nickname) {
// 下面异步相当于打开浏览器
# convert_materials_to_cycles.py
#
# Copyright (C) 5-mar-2012, Silvio Falcinelli. Fixes by others.
#
# special thanks to user blenderartists.org cmomoney
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@a-nakanosora
a-nakanosora / blscript_save_viewport_buffer_as_image.py
Last active September 16, 2023 23:36
Blender Script - Save viewport buffer as an image
''' blscript_save_viewport_buffer_as_image.py
'''
import bpy
import bgl
def main():
def get_region_view3d():
'''
context = bpy.context
@AndrewRayCode
AndrewRayCode / example-bake.py
Created July 6, 2016 19:45
Blender Python script to bake in an ambient occlusion map offline
import bpy
ops = bpy.ops
scene = bpy.context.scene
mesh = bpy.ops.mesh
# Delete default scene objects
ops.object.select_all()
ops.object.select_all()
ops.object.delete()
@Fweeb
Fweeb / blender-multi_gpu.markdown
Last active July 13, 2024 12:09
Rendering in Blender on a machine with multiple GPUs

Rendering in Blender on a machine with multiple GPUs

So here's the premise: For scenes that take around a minute or less to render, performance is actually worse if you render on all of the cards with a single instance of Blender. This is because (AFAIK) there's a bit of additional time necessary to collect the render results from each card and stitch them together. That time is a fixed short duration, so it's negligible on larger/longer render jobs. However, on shorter render jobs, the 'stitch time' has a much more significant impact.

I ran into this with a machine I render on that has 4 Quadro K6000s in it. To render animations, I ended up writing a few little scripts to facilitate launching 4 separate instances of Blender, each one tied to one GPU. Overall rendertime was much shorter with that setup than one instance of Blender using all 4 GPUs.

The setup works basically like this... I have a the following Python script (it can be anywhere on your hard drive, so long as you remember the path to it).

@bennylope
bennylope / ffmpeg-watermark.md
Created April 22, 2016 23:17 — forked from webkader/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

using System;
namespace com.qingyi
{
public class Singleton<T>
where T : class, new()
{
private static T mUniqueInstance;
public static bool Exists
@JoshCheek
JoshCheek / A.hx
Last active October 28, 2020 07:58
Haxe macro to define functions.
// file: zomg/A.hx
package zomg;
class A {
public static function x() {
trace("this is a");
}
}
@diramazioni
diramazioni / texture_change.py
Created February 27, 2014 17:54
blender python: texture change from command line
'''
texture image path are relative to the blend file directory. run from command line like this:
texture=img/2012720989_c.jpg blender -b mug.blend --python texture_change.py -F PNG -s 1 -e 1 -j 1 -t 0 -a
''''
import os
image_file = os.getenv('texture')
if not image_file:
image_file="img/2012720989_c.jpg"
#if macro
import haxe.macro.Context;
import haxe.macro.Expr;
class SchemaTypeBuilder
{
public static function build(ref:String):haxe.macro.Type
{
var schema = haxe.Json.parse(sys.io.File.getContent(ref));
var type:ComplexType = parseType(schema);