Skip to content

Instantly share code, notes, and snippets.

View daimor's full-sized avatar

Dmitry Maslennikov daimor

View GitHub Profile
@daimor
daimor / cplatname.patch
Created April 6, 2014 13:15
Patch for GlobalsDB cplatname for enable installing to CentOS, and Ubuntu any versions
--- cplatname 2013-05-02 17:50:01.000000000 -0700
+++ cplatname.new 2014-04-05 11:43:21.676624274 -0700
@@ -114,13 +114,13 @@
distName=`cat /etc/issue | cut -f1 -d" "`
version=`cat /etc/issue | cut -f2 -d" " | cut -f1-2 -d"."`
proc=`uname -m`
- if [ "$distName" = "Ubuntu" -a "$version" = "11.04" -a "$proc" = "x86_64" ] ; then
+ if [ "$distName" = "Ubuntu" -a "$proc" = "x86_64" ] ; then
plat="lnxsusex64"
fi
@daimor
daimor / globalsdb
Last active August 29, 2015 13:58
GlobalsDB starts script
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: GlobalsDB
# Required-Start:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts GlobalsDB
# Description: Starts GlobalsDB
### END INIT INFO
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Class name="%CDEV.JSON.Base">
<Abstract>1</Abstract>
<Super>%Library.RegisteredObject</Super>
<TimeCreated>63290,83008.228357</TimeCreated>
<Method name="%WriteJSON">
</Method>
@daimor
daimor / StudioRoutines.xml
Created May 18, 2014 20:24
Caché JavaScript Routine
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25" zv="Cache for UNIX (SUSE Linux Enterprise Server for x86-64) 2014.1 (Build 608U)" ts="2014-05-19 00:22:31">
<Class name="%CJS.RoutineWizard">
<Description><![CDATA[
Studio Template:<br>
Create a new Cache JavaScript Routine.]]></Description>
<StorageStrategy/>
<Super>%ZEN.Template.studioTemplate</Super>
<TimeChanged>63325,86382.045933</TimeChanged>
<TimeCreated>63325,65834.566957</TimeCreated>
@daimor
daimor / ccontrol
Last active August 19, 2021 04:56
bash completions for InterSystems cache
#!/bin/bash
# bash completions for InterSystems ccontrol
_instances()
{
if [ $# == 0 ] || [ $1 == "all" ]; then
echo $(ccontrol qlist | cut -d'^' -f1 | tr '\n' ' ')
else
echo $(ccontrol qlist | grep "\^$1\," | cut -d'^' -f1 | tr '\n' ' ')
fi
Class Debug.Trace Extends %RegisteredObject
{
ClassMethod On(aGN As %String = "") As %Status [ ProcedureBlock = 0 ]
{
#define InvalidIO $io'=$p
if aGN="" set %TraceLog=$name(^CacheTemp.TraceLog)
else set %TraceLog=aGN
kill @%TraceLog
for i=1:1:$stack-1 {
#include %occInclude
kill
set host="chat.freenode.net"
set port="6667"
set sock=##class(%IO.Socket).%New()
set linepat=##class(%Regex.Matcher).%New("^\:([^\!\ ]+)\![^\ ]+\ (.+)$")
set privmsg=##class(%Regex.Matcher).%New("^PRIVMSG #([^\ ]+) \:(.+)")
set action=##class(%Regex.Matcher).%New("!(?:bot|BOT) (.+)")
try {
@daimor
daimor / cosJSON.isc
Created December 21, 2016 08:00 — forked from isc-bspead/cosJSON.isc
Macros for writing forward compatible JSON code in InterSystems Caché 2016.1
#include %occReference
#if $$$comClassDefined("%Library.Object")
#define jsonClassIsLatestVersion $classIsLatestVersion
//usage: obj.$$$jsonClassIsLatestVersion()
#define jsonExtends $extends
//usage: {}.$$$jsonExtends(classname)
#define jsonFromJSON $fromJSON
//usage: {}.$$$jsonFromJSON(string)
#define jsonGetIterator $getIterator
//usage: obj.$$$jsonGetIterator()
Class Utils.Global Extends %RegisteredObject
{
/// Анализ размера глобала, с анализом размера его подузлов, на указанную вложенность
/// все необходимые параметры будут запршены при запуске
ClassMethod GlobalSize() [ PublicList = (big, DatabaseBlockSize, blksiz, cc, Bytes, Count, gls, lev) ]
{
set $ztrap="err"
set dir=$$selectdb()
do {
@daimor
daimor / csession
Last active January 26, 2018 08:21
csession script which working with docker
#!/bin/bash
NAME=$1
CONTAINER=`docker container ls -q -f "name=$NAME"`
if [ -z $CONTAINER ]
then
echo "Docker container with name $NAME not found"
exit 1
fi