Skip to content

Instantly share code, notes, and snippets.

View satishgoda's full-sized avatar

Satish Goda satishgoda

View GitHub Profile
@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)
@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
#!/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
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
'''
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
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()
import bpy
from mathutils.geometry import interpolate_bezier
def get_points(spline, clean=True):
knots = spline.bezier_points
if len(knots) < 2:
return