Skip to content

Instantly share code, notes, and snippets.

View scalone's full-sized avatar

Thiago Scalone scalone

  • CloudWalk
  • São Paulo / SP
View GitHub Profile
module Diagnostic
class KeyInject
FILE = './shared/injected_keys.json'
def self.table_exist?
File.exists?(FILE)
end
def self.table
self.setup unless @table
module Diagnostic
class KeyInject
FILE = './shared/injected_keys.json'
def self.table_exist?
File.exists?(FILE)
end
def self.table
self.setup unless @table
package main
import (
"encoding/json"
"fmt"
)
type middlewareResponse struct {
Received json.RawMessage `json:"received"`
AuthSent json.RawMessage `json:"auth_sent"`
int main(void)
{
mrbc_context *c;
mrb_state *mrb;
mrb_allocf allocf;
void *ud;
context_memprof_init(&allocf, &ud);
mrb = mrb_open_allocf(allocf, ud);
<function name="fn_main">
<cleandisplay />
<integervariable value="0" variable="iReturn" />
<integervariable value="0" variable="iIterator" />
<stringvariable value="" variable="sReturn" />
<inttostring variableinteger="$(iReturn)" variablestring="$(sReturn)" />
<editfile filename="config.dat" key="touchscreen" value="1"/>
#!/usr/bin/env ruby
module Hashname
def self.calc_hashname(name)
name.chars.inject(5381) do |hash, ch|
max_int = (hash << 5) + hash + ch.ord
self.force_overflow_unsigned(max_int)
end
end
def fn_translate_string_align(str)
columns = STDOUT.max_x
if str.size > columns
0
else
((columns - str.size) / 2).to_i
end
end
def fn_show_message
unless @sMessage.to_s.strip.empty?
<!-- fn_align_center -->
<function name="fn_align_center">
<integervariable value="21" variable="iDisplayColumns"/>
<integervariable value="0" variable="iLenMessage"/>
<integervariable value="1" variable="iCharCount"/>
<integervariable value="0" variable="iSpaceCount"/>
<if variable="$(iIsPrint)" operator="equalto" value="1">
<integervariable value="42" variable="iDisplayColumns" />
<else />
def fn_align_center
@iDisplayColumns = Variable.create(21, self)
@iLenMessage = Variable.create(0, self)
@iCharCount = Variable.create(1, self)
@iSpaceCount = Variable.create(0, self)
if @iIsPrint.compare(Variable.create("equalto", self), Variable.create("1", self))
@iDisplayColumns = Variable.create(42, self)
else
file_read_db(Variable.create("config.dat", self), Variable.create("model", self), @sDeviceModel)
string_find(@sSpecialScreenModels, @sDeviceModel, Variable.create("0", self), @iRet)
#!/usr/bin/python
# File Name: setup.py
# Created: 23-02-2011
import sys
def main(argv):
"""main func"""
try:
from setuptools import setup