Skip to content

Instantly share code, notes, and snippets.

// holds script-specific information (i.e. how to load the script data,
// name of the script, script runtime version required, etc.)
type Script struct {
}
// parameters to the script, TBD if key/value or positional
type ScriptParam struct {
}
// current script execution scope. Defines global variables, pre-exising variables
// from the current scope, etc.
type Scope struct {
// holds script-specific information (i.e. how to load the script data,
// name of the script, script runtime version required, etc.)
type Script struct {
}
// parameters to the script, TBD if key/value or positional
type ScriptParam struct {
}
// current script execution context. Defines global variables, pre-exising variables
// from the current scope, etc.
type ScriptContext struct {
// holds script-specific information (i.e. how to load the script data,
// name of the script, script runtime version required, etc.)
type Script struct {
}
// current script execution context. Defines global variables, pre-exising variables
// from the current scope, etc.
type ScriptContext struct {
}
// accepts a script structure, and a script context
// Runs the custom scripting language
func RunScript() {
}
function aes_encrypt {
(
source ~/.aes.sh >/dev/null 2>&1
test -t 0 >/dev/null 2>&1
if [ $? -eq 0 ] ; then
decrypted="$1"
encrypted="$decrypted".enc
openssl enc -in "$decrypted" -out "$encrypted" -e -aes256 -k "$AES_KEY"
else
openssl enc -e -aes256 -k "$AES_KEY"
@d0c-s4vage
d0c-s4vage / python_import.vim
Created November 10, 2016 20:36
Short vim script that maps CTRL+j in normal and insert mode to add a new import (and sort the imports) in a Python file.
function! PythonAddImportInsertLeave(insert_mode)
execute "normal! V/import.*$\\n\\s*\\n\<CR>"
execute "normal! !sort\<CR>"
execute "normal! `mzz"
" remove import auto-cmd
autocmd! PythonAddImport *
if a:insert_mode
call feedkeys("a")
@d0c-s4vage
d0c-s4vage / flask_sqlalchemy_historify.py
Last active March 15, 2021 16:28
Flask SQLAlchemy Historify
# I used this code directly in my models.py - it expects a `db` variable to be
# present in the globals.
#
# I also used Flask-JWT in the application that used this code. If you're not using
# Flask-JWT, you should modify `get_current_username` to not check for a current
# user using Flask-JWT.
def historify(cls):
"""
Create a new history table for the provided database model (``cls``),
@d0c-s4vage
d0c-s4vage / autopypi.py
Created March 13, 2016 13:32
A simple script to auto-install packages from pypi when they are imported.
#!/usr/bin/env python
# encoding: utf-8
import imp
import os
import pdb
import pip
import readline
from pip.commands.search import SearchCommand
import sys
@d0c-s4vage
d0c-s4vage / transform.vim
Last active February 23, 2016 20:53
Simple vim script to define transforms for specific file types, be it gpg encryption, aes256 with openssl, base64, etc.
scriptencoding utf-8
function! PrepareTrans()
setl viminfo=
setl noswapfile
if exists("+undofile")
setl noundofile
endif
setl noeol
setl binary
#!/usr/bin/env python
# encoding: utf-8
import clang
import clang.cindex
from clang.cindex import CursorKind as CK
import os
import pprint
import sys