This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION SF_GET_LIST_SIMILARITY( | |
p_list1 text[], | |
p_list2 text[] | |
) RETURNS NUMERIC(19,4) AS $$ | |
DECLARE | |
w_list text[] := '{}'; | |
BEGIN | |
IF p_list1 IS NULL OR p_list2 IS NULL THEN | |
RETURN 0; | |
END IF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION SF_IN_LIST( | |
p_list1 text[], | |
p_list2 text[] | |
) RETURNS BOOLEAN AS $$ | |
DECLARE | |
w_is_in_list BOOLEAN := true; | |
BEGIN | |
IF p_list1 IS NULL OR p_list2 IS NULL THEN | |
RETURN false; | |
END IF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_obj_attr(root, str_path, default_val="", debug=False): | |
attr_path = str_path.split(".") | |
base_obj = root | |
for attr in attr_path: | |
if hasattr(base_obj, attr): | |
base_obj = base_obj.__dict__[attr] | |
else: | |
if debug: | |
print "No attribute: %s" % attr | |
base_obj = default_val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xmlrpc = require('xmlrpc'); | |
var Hatebu = {}; | |
Hatebu.getHatebuCount = function (domain, callback) { | |
var client = xmlrpc.createClient({ | |
host: "b.hatena.ne.jp", | |
path: "/xmlrpc" | |
}); | |
client.methodCall('bookmark.getTotalCount', [domain], function (error, value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
, bodyParser = require('body-parser') | |
, ifttt = require('./ifttt') | |
, http = require('http') | |
, path = require('path'); | |
var app = express(); | |
// all environments | |
app.set('port', process.env.PORT || 3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cron = require('node-cron'); | |
const exampletask = require('./exampletask'); | |
cron.schedule('0 9 * * * *', () => { | |
exampletask.main(); | |
console.log('task completed'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const msnodesql = require("msnodesqlv8"); | |
async function fetchDataList(conn, query) { | |
return new Promise((resolve, reject) => { | |
conn.query(query, (err, rows) => { | |
if (err !== null) { | |
reject(err); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WebSocket = require('ws'); | |
const app = require('express')(); | |
const server = require('http').Server(app); | |
const uuid = require('uuid/v4'); | |
// Creates a JSON string for "setblock" command request | |
function setBlockCommand(x, y, z, blockType) { | |
return JSON.stringify({ | |
"body": { | |
"origin": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const fs = require('fs'); | |
const cv = require('opencv4nodejs'); | |
function convertImageToLineDrawing(img) { | |
const kernel = new cv.Mat([ | |
[1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Ssh = require('node-ssh'); | |
async function main() { | |
const ssh = new Ssh(); | |
const sshPassword = 'SSH_PASSWORD'; | |
// connect | |
await ssh.connect({ | |
host: 'SSH_HOST_ADDRESS', |
OlderNewer