Skip to content

Instantly share code, notes, and snippets.

View satishgoda's full-sized avatar

Satish Goda satishgoda

View GitHub Profile
#!/bin/sh
VALUE_ICON=`cygpath -d "$HOME/pict/terminal.png"`
VALUE_TITLE="terminal"
VALUE_MESSAGE="Ha!!"
while getopts hi:t:m: OPT
do
case $OPT in
import bpy
from mathutils.geometry import interpolate_bezier
def get_points(spline, clean=True):
knots = spline.bezier_points
if len(knots) < 2:
return
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()
'''
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
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
class MyCallable(object):
def __init__(self, urlparts, callable):
self.urlparts = urlparts
self.callable = callable
def __call__(self, **kwargs):
print kwargs
print self.urlparts
def __getattr__(self, name):
# Return a callable object of this same type so that you can just keep
# chaining together calls and just adding that missing attribute to the
@satishgoda
satishgoda / python-monkey-patch-built-ins.py
Created October 9, 2016 09:13 — forked from mahmoudimus/python-monkey-patch-built-ins.py
pythonic monkey patching built-in types
# found this from Armin R. on Twitter, what a beautiful gem ;)
import ctypes
from types import DictProxyType, MethodType
# figure out side of _Py_ssize_t
if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
_Py_ssize_t = ctypes.c_int64
else:
_Py_ssize_t = ctypes.c_int
@satishgoda
satishgoda / outline-mode-folding-python-elisp-shell.el
Created January 22, 2017 02:49 — forked from alphapapa/outline-mode-folding-python-elisp-shell.el
Emacs: outline-mode folding for Python, elisp, and shell
(defun my/python-mode-outline-hook ()
(setq outline-level 'my/python-outline-level)
(setq outline-regexp
(rx (or
;; Commented outline heading
(group
(* space) ; 0 or more spaces
(one-or-more (syntax comment-start))
(one-or-more space)
from rx import Observable, Observer
from collections import defaultdict
users = [
{ "id" : 0, "name" : "Hero" },
{ "id" : 1, "name" : "Dunn" },
{ "id" : 2, "name" : "Sue" },
{ "id" : 3, "name" : "Chi" },
{ "id" : 4, "name" : "Thor" },
{ "id" : 5, "name" : "Clive" },
@satishgoda
satishgoda / painting2sprites.sh
Created April 18, 2017 02:50 — forked from jessevanherk/painting2sprites.sh
script to convert an ORA file from Krita to PNGs
#!/bin/bash
# painting2sprites - A simple script to read an ORA, resize and trim output PNGs.
INPUT_FILE=$1
OUTPUT_DIR=$2
RESIZE_SCALE="25%"
if [ "$2" == "" ]; then
import maya.cmds
import maya.utils
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
from threading import Thread
class SimpleEcho(WebSocket):
def handleMessage(self):
# echo message back to client
#self.sendMessage(maya.utils.executeInMainThreadWithResult(self.data))