Skip to content

Instantly share code, notes, and snippets.

View jdevera's full-sized avatar

Jacobo de Vera jdevera

View GitHub Profile
# sm apidoc
A command has returned error code '(1)' without being handled.
+# source file # function()
================================================================================================================================================================================================================
vi +15 core/internal/shell/extensions/execution/functions # __sm.extension.actions.type
vi +149 core/sm/shell/core/initialize # /opt/sm/core/sm/shell/core/initialize
vi +29 bin/sm # /opt/sm/bin/sm
================================================================================================================================================================================================================
@jdevera
jdevera / gist:1455193
Created December 10, 2011 13:42
sm set help broken
# sm set help
__sm.actions.call:6: command not found: sets_help
A command has returned error code '(127)' without being handled.
+# source file # function()
================================================================================================================================================================================================================
vi +454 /opt/sm/core/sm/shell/log/functions # __sm.actions.call
vi +178 /opt/sm/core/internal/shell/extensions/execution/functions # __sm.extension.run
vi +150 /opt/sm/core/sm/shell/core/initialize # /opt/sm/core/sm/shell/core/initialize
@jdevera
jdevera / gist:1455251
Created December 10, 2011 14:10
sm functions not loading
# sm set install irc
# sm znc help
/opt/sm/sets/active/irc/znc/bin/help:3: command not found: description
A command has returned error code '(127)' without being handled.
+# source file # function()
================================================================================================================================================================================================================
vi +3 bin/help # /opt/sm/sets/active/irc/znc/bin/help
@jdevera
jdevera / gist:1481602
Created December 15, 2011 15:56
Sm completion error
# sm --trace=all --call=api/extensions/completion/extension_action_completion -- sm
+/opt/sm/core/sm/shell/core/cli:124 /opt/sm/core/sm/shell/core/cli():124 > debug_flags=-search
+/opt/sm/core/sm/shell/core/cli:125 /opt/sm/core/sm/shell/core/cli():125 > trace_flags=all
+/opt/sm/core/sm/shell/core/cli:127 /opt/sm/core/sm/shell/core/cli():127 > export debug_flag debug_flags trace_flag trace_flags verbose_flag extension_args sm_script var_debug_flags var_debug_type_flag
+/opt/sm/bin/sm:29 /opt/sm/bin/sm():29 > . /opt/sm/core/sm/shell/core/initialize
+/opt/sm/core/sm/shell/core/initialize:4 /opt/sm/core/sm/shell/core/initialize():4 > setopt EXTENDED_GLOB NULL_GLOB HASH_CMDS WARN_CREATE_GLOBAL
+/opt/sm/core/sm/shell/core/initialize:6 /opt/sm/core/sm/shell/core/initialize():6 > saved_sm_path=/opt/sm
+/opt/sm/core/sm/shell/core/initialize:9 /opt/sm/core/sm/shell/core/initialize():9 > file=/etc/smrc
+/opt/sm/core/sm/shell/core/initialize:11 /opt/sm/core/sm/shell/core/initialize():11 > [[ -s /etc/smrc ]]
+/opt/sm/c
@jdevera
jdevera / tree.md
Created April 24, 2012 08:36 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@jdevera
jdevera / new_bashrc.sh
Created August 11, 2012 12:39 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
@jdevera
jdevera / objectify.py
Created November 15, 2012 11:08
Python Data Structure Objectifier
#!/usr/bin/env python
"""
An objectifier for python data structures based on standard containers.
Based on sveral answers to this stackoverflow question:
http://stackoverflow.com/q/1305532/116957
Licensed under Creative Commons Attribution-ShareAlike
http://creativecommons.org/licenses/by-sa/3.0/
"""
@jdevera
jdevera / sub-sh-evalme
Created June 4, 2013 23:58
Structure for subs that output code to be eval'ed
#!/usr/bin/env bash
set -e
if [[ $1 != '__testrun__' ]]; then
sed '1,/^#BEGINEVAL/d' "$BASH_SOURCE"
exit 0
fi
#BEGINEVAL
@jdevera
jdevera / matcher.py
Last active December 29, 2015 07:58
A python class to do saner "if..match"
class Matcher(object):
"""
A more convenient way to check regex matches. It holds the latest match
result for further checks.
The current regex match mechanism does not allow for checking matches in
if/elif chains. Thanks to Matcher now one can do this:
>>> m = Matcher()
>>> s = "ba"
@jdevera
jdevera / pr.md
Last active August 29, 2015 14:17 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: