Skip to content

Instantly share code, notes, and snippets.

View yusukei's full-sized avatar

Yusuke Ishikawa yusukei

  • Japan
View GitHub Profile
@yusukei
yusukei / gist:4760688
Created February 12, 2013 06:52
サンプリング点の生成を可視化(SSAO) http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20101122
import maya.cmds as cmds
from math import sqrt, pow, cos, sin
import random
rand = random.random
R = 5
for i in range(5000):
r = R * rand()
#r = R * pow(rand(), 1.0/3)
t = 6.2831853 * rand() # 2pi * u
@yusukei
yusukei / pyae.cpp
Last active January 29, 2021 15:11
Python embedded for AfterEffects.
#include "SoSharedLibDefs.h"
#include "SoCClient.h"
#define EXPORT extern "C" __declspec(dllexport)
#define strdup _strdup
// ------------------------------------------------------------------
// 宣言
// ------------------------------------------------------------------
import maya.OpenMayaUI
from PySide import QtGui
import shiboken
import maya.cmds as cmds
panel = cmds.getPanel(scriptType="scriptEditorPanel")[0]
widget = maya.OpenMayaUI.MQtUtil.findLayout(panel)
scriptEditor = shiboken.wrapInstance(long(widget), QtGui.QWidget)
mainWindow = shiboken.wrapInstance(long(maya.OpenMayaUI.MQtUtil.mainWindow()), QtGui.QWidget)
win = QtGui.QDockWidget('test', parent=mainWindow)
>>> fs = []
>>> from pprint import pprint
>>>
>>> for i in range(4):
... a = str(i)
... func = lambda : pprint(a)
... fs.append(func)
...
>>> fs[0]()
'3'
class ImgWidget(QtGui.QWidget):
def __init__(self, imagePath, x=None, y=None, parent=None):
super(ImgWidget, self).__init__(parent)
self.pic = QtGui.QPixmap(imagePath)
self.x = x
self.y = y
def paintEvent(self, event):
@yusukei
yusukei / code.py
Created September 24, 2011 03:49
traceback test
from pprint import pprint
from cStringIO import StringIO
stdout = StringIO()
def test():
try:
a
@yusukei
yusukei / tmux-fix.rb
Created August 31, 2011 01:10
tmux with pasteboard Formula
require 'formula'
class TmuxFix < Formula
url 'http://sourceforge.net/projects/tmux/files/tmux/tmux-1.5/tmux-1.5.tar.gz'
md5 '3d4b683572af34e83bc8b183a8285263'
homepage 'http://tmux.sourceforge.net'
depends_on 'libevent'
depends_on 'tmux-MacOSX-pasteboard'
@yusukei
yusukei / gist:1170871
Created August 25, 2011 15:06
tmux 1.5 with pasteboard
diff --git a/window-copy.c b/window-copy.c
index b49be33..9537ad5 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -23,6 +23,7 @@
#include "tmux.h"
+void to_pasteboard(char *buf);
struct screen *window_copy_init(struct window_pane *);
./configure --prefix=/usr/local/python27 --enable-shared
yum install zlib-devel readline-devel openssl-devel bzip2-devel gdbm-devel
@yusukei
yusukei / Login Hook.txt
Created February 5, 2011 15:25
MaxOSX LoginHook
sudo defaults write com.apple.loginwindow LoginHook /etc/rc.local
#!/bin/bash
# once
#sudo unlink /tmp
#sudo ln -s /Volumes/ramdisk /tmp
# Make RamDisk
if [ ! -d /Volumes/ramdisk ]