Skip to content

Instantly share code, notes, and snippets.

View falkolab's full-sized avatar
🏠
Working from home

Andrey Tkachenko falkolab

🏠
Working from home
  • Russian Federation
View GitHub Profile
@falkolab
falkolab / gist:17d5af280ef09e98856c5e998713625f
Last active October 11, 2023 12:46
New act runner run in docker lead to error 500 on server
Runner logs:
time="2023-10-11T08:48:01Z" level=info msg="Starting runner daemon"
time="2023-10-11T08:48:01Z" level=warning msg="Because the Gitea instance is an old version, skip declare labels and version."
time="2023-10-11T08:48:01Z" level=error msg="failed to fetch task" error="unknown: rpc error: code = Unauthenticated desc = unregistered runner"
...
Server logs:
@falkolab
falkolab / Dockerfile
Last active October 23, 2022 17:35
Docker. Install TA-lib alpine wheel multistage build
FROM python:3-alpine as talib_build
# TA-Lib
RUN apk add --virtual .build-deps musl-dev build-base && \
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && tar -xvzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib/ && ./configure --prefix=/talib_dist && make && make install && \
python3 -m pip wheel --wheel-dir=/wheels TA-Lib==0.4.24 && \
apk del .build-deps && cd .. && rm -rf ./ta-lib && rm -rf ./ta-lib-0.4.0-src.tar.gz
FROM python:3-alpine
@falkolab
falkolab / README.md
Last active July 18, 2017 22:35
How to use latest Alloy with appc CLI

If you want to use latest alloy with appc CLI command:

  1. Update Alloy: [sudo] npm install -g alloy

  2. Create file in your project <project root>/plugins/global.alloy/1.0/hooks/global_alloy_hook.js with content:

exports.init = function (logger, config, cli, appc) {
	delete process.env.ALLOY_PATH;
};
@falkolab
falkolab / example.js
Created March 17, 2016 06:35
How to access to file in storage card `/sdcard/anyfolder/myfile` in Titanium SDK
// need storage permission to be added in manifest
function getFileFromExternalStorage(path) {
if(Ti.Filesystem.isExternalStoragePresent()) {
var file = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, path);
var newPath = file.nativePath.split(Ti.Filesystem.separator + Ti.App.id).join('');
file = Ti.Filesystem.getFile(newPath);
if(file.exists()) return file;
}
return null;
}
@falkolab
falkolab / alloy.js
Last active March 14, 2017 22:51
Application launch manager for Titanium SDK
require('runner').on('run', function(evt) {
// evt.source - runner module reference
var hc = Alloy.CFG.homeController;
// home window launch
Alloy.createController(hc.name, hc.args).getView().open();
});
@falkolab
falkolab / bbcode2html.js
Created February 6, 2016 18:46
Android: HTML tags and localized strings for Titanium SDK.
/* Escapes a string for use with regular expressions */
function escapeString(input) {
return input.replace(/([\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,
function(c){return "\\" + c;});
}
/* replaces all */
function replaceAll(search, input, replacement, ignore) {
return input.replace(
new RegExp(escapeString(search), "g"+(ignore?"i":"")),
@falkolab
falkolab / fix_timob20357.js
Last active March 14, 2016 13:51
Fix for Titanium SDK bug TC-5848 (Button 9-patch)
/*
Created by: Andrey Tkachenko falko.lab@gmail.com
Source: https://gist.github.com/falkolab/c56585874223216e85d3
This is fix code for https://jira.appcelerator.org/browse/TIMOB-20357
!!! You must use only $.addListener for fixed button NOT button.addEventListener
`win` argument can be omited if controller root is Window already.
example:
@falkolab
falkolab / resizeToContainer.js
Created January 28, 2016 14:57
Titanium SDK helper to resize
function resizePhoto(blob, size) {
var measurement = require('alloy/measurement'), w, h;
if (blob.width / blob.height >= size.width / size.height) {
w = measurement.dpToPX(size.width);
h = blob.height * measurement.dpToPX(size.width) / blob.width;
} else {
w = blob.width * measurement.dpToPX(size.height) / blob.height;
h = measurement.dpToPX(size.height);
@falkolab
falkolab / demo.js
Created December 5, 2015 12:30
underscore string mixin
//******** underscore.string ***********
var _ = require("alloy/underscore")._;
// Import Underscore.string to separate object,
// because there are conflict functions (include, reverse, contains)
_.str = require('underscore.string');
// Mix in non-conflict functions to Underscore namespace if you want
_.mixin(_.str.exports());
@falkolab
falkolab / alloy.js
Last active February 7, 2016 02:58
Network state monitor for Titanium SDK
require('networkMonitor').init();