Skip to content

Instantly share code, notes, and snippets.

View schamane's full-sized avatar

Nazar Kulyk schamane

View GitHub Profile
@schamane
schamane / docker-compose.yaml
Created January 10, 2023 12:35
docker-compose.yaml for podman
version: '3'
services:
portainer-ce:
image: portainer/portainer-ce
ports:
- "9443:9443"
volumes:
- /run/podman/podman.sock:/var/run/docker.sock:Z
privileged: true
@schamane
schamane / kohaActionLogExcelFilter.js
Created April 18, 2021 17:47
Create excel with Koha action logs excel
const { get, map, replace } = require('lodash');
const { readFile, writeFile, utils } = require('xlsx');
const { format } = require('date-fns');
const workBook = readFile('./nadiajka_koha_excel.xlsx');
const sheetName = workBook.SheetNames[1];
const sheetData = utils.sheet_to_json(workBook.Sheets[sheetName], {
blankrows: true,
defval: undefined
});
@schamane
schamane / deleteGitTag.sh
Created September 20, 2020 11:08
Delete GIT Tag
git tag -d [tag];
git push origin :[tag]
@schamane
schamane / curl.js
Created February 23, 2013 09:47
Curl vs http module for nodejs
var exec = require('child_process').exec,
url = "http://google.com/",
timeout = "3",
data="?q=test";
var time = process.hrtime();
exec('curl --max-time ' + timeout + ' -d \'' + data + '\' ' + url, function (error, stdout, stderr) {
var diff = process.hrtime(time);
//console.log('stdout: ' + stdout);
//console.log('stderr: ' + stderr);
@schamane
schamane / adder.js
Created September 21, 2012 11:24
Nodejs inheritance
/* main class */
var Adder = function(a, b){
this.a = a || 1;
this.b = b || 2;
};
Adder.prototype.add = function() {
return this.a + this.b;
};
@schamane
schamane / test1.js
Created July 26, 2012 08:46
premature optimization
var pool = {
query: function(sql, callback) {
process.nextTick(function() {
var result = [
{0:12345, 1:'EUR/USD', 2:1.2234, 3:1.2221, 4:1.2240, length: 5},
{0:12345, 1:'EUR/USD', 2:1.2234, 3:1.2221, 4:1.2240, length: 5 },
{0:12345, 1:'EUR/USD', 2:1.2234, 3:1.2221, 4:1.2240, length: 5}]
callback(null, result);
});
}
function parseRequestForMultipartFiles(req, arg, callback){
var form = new formidable.IncomingForm();
fs.mkdir(GLOBAL.basePthToSave + arg, function(e) {
form.uploadDir = GLOBAL.basePthToSave + arg;
form.parse(req, function(err, fields, files){
callback(files);
@schamane
schamane / index.html
Created February 14, 2012 14:07
lostmen.ru calc
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>title</title>
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div>
/*
YUI 3.4.0 (build 3928)
Copyright 2011 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
html{color:#000;background:#FFF}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}li{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}input,textarea,select{*font-size:100%}legend{color:#000}
var Controller = function(req, res) {
var DB = require("./db").DB;
this._db = new DB();
this._req = req;
this._res = res;
console.log(new Date() + ' : ' + req.url);
};
Controller.HTTP_OK_CODE = 200;