Skip to content

Instantly share code, notes, and snippets.

View caiwan's full-sized avatar
🐺

Caiwan caiwan

🐺
View GitHub Profile
@caiwan
caiwan / .bashrc
Last active November 25, 2017 20:43
Bashrc for GitBash on windows to init ssh-agent and load keys
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
agent_load_env
@caiwan
caiwan / bake.py
Created September 1, 2017 13:10
Blender bake
import bpy
def do_bake(scene):
""" This thing tries to bake all the object animations
and camera movement into a single track
Drawback: it eleminates scenegraph hierarchy and flattens everzthing
This suposed to be it, but fingers crossed:
https://wiki.blender.org/index.php/Dev:2.4/Source/Animation/AnimationBaking
@caiwan
caiwan / add_pbr.py
Last active September 4, 2017 09:13
Handy blender scripts
# quick add pbr texture names to properties
# used in grafkit2
for material in bpy.data.materials:
for key in ["metalness", "normal", "roughness"]:
material["mat_{0}".format(key)] = "pbr_{0}_{1}.jpg".format(material.name, key)
# a bit refined version, which add emissive map if emission was set
for material in bpy.data.materials:
@caiwan
caiwan / .vimrc
Created September 21, 2017 08:05
My own vimrc file to make vim more comortable
set encoding=utf-8
set fileencoding=utf-8
filetype plugin indent on
syntax on
set smartindent
set expandtab
set ignorecase
set smartcase
@caiwan
caiwan / keypad.lua
Created May 8, 2018 23:11
External key macros for Photoshop for a numeric keypad
clear()
local keyboardIdentifier = '16BFD3AF'
lmc_print_devices()
-- assign logical name to macro keyboard
if keyboardIdentifier == '0000AAA' then
lmc_assign_keyboard('MACROS');
else lmc_device_set_name('MACROS', keyboardIdentifier);
@caiwan
caiwan / pub_sub_cpp.cpp
Created June 9, 2018 08:51 — forked from makomweb/pub_sub_cpp.cpp
Fun with C++: implementing a pub/sub scenario using std::bind and other standard facilities. The approach is pretty similar to the well known .NET event mechanism.
#include <iostream>
#include <map>
#include <algorithm>
#include <functional>
#include <memory>
using namespace std;
class EventArgs {
public:
@caiwan
caiwan / 2D-art-collection.md
Last active June 11, 2018 08:41
Art material collection
@caiwan
caiwan / components.py
Created September 18, 2018 14:18
Flask + peewee app skeleton
import logging
import inspect
import os
import sys
import inspect
import logging
import json
from datetime import datetime
@caiwan
caiwan / Bootstrap-theme.vue
Created October 25, 2018 12:06
Some feature showoff for bootstrap when dealing w/ theme override
<template>
<div class="container">
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-8 col-md-7 col-sm-6">
<h1>Darkly</h1>
<p class="lead">Flatly in night mode</p>
</div>
</div>
@caiwan
caiwan / git-lg-alias
Created April 29, 2019 09:03
Graph view alias for git log
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"