Skip to content

Instantly share code, notes, and snippets.

package com.sftptogo;
import com.jcraft.jsch.*;
import com.sftptogo.util.Util;
import java.util.Properties;
import java.util.Vector;
/**
* A simple SFTP client using JSCH http://www.jcraft.com/jsch/
let Client = require('ssh2-sftp-client');
class SFTPClient {
constructor() {
this.client = new Client();
}
async connect(options) {
console.log(`Connecting to ${options.host}:${options.port}`);
@saggineumann
saggineumann / FileImporterService.rb
Last active April 4, 2022 10:14
SFTP Shopify File Synchornization
module FileServices
class FileImporterService < ApplicationService
attr_reader :shop
class FileCreateError < StandardError
end
def initialize(shop)
@shop = shop
end
require 'net/sftp'
require 'uri'
class SFTPClient
def initialize(host, user, password)
@host = host
@user = user
@password = password
end
import pysftp
from urllib.parse import urlparse
import os
class Sftp:
def __init__(self, hostname, username, password, port=22):
"""Constructor Method"""
# Set connection object to None (initial value)
self.connection = None
@saggineumann
saggineumann / connect-class.php
Last active July 12, 2021 13:36
connect.php Connect to SFTP using PHP
<?php
class SFTPClient
{
private $connection;
private $sftp;
public function __construct($host, $port=22)
{
$this->connection = @ssh2_connect($host, $port);
if (! $this->connection)
@saggineumann
saggineumann / connect.go
Last active October 19, 2022 18:48
Connect to SFTP using Go
package main
import (
"fmt"
"io"
"os"
"net"
"net/url"
"bufio"
"strings"
@saggineumann
saggineumann / client_workflow.py
Created February 29, 2016 09:37
Client workflow
# to install xplenty python SDK run: pip install xplenty
# more info here: https://github.com/xplenty/xplenty.py
from xplenty import XplentyClient
import time
account_id = "" # your account id (http://app.xplenty.com/account_id/)
api_key = "" # your api key (get it here https://app.xplenty.com/settings/edit)
cluster_nodes = 1 # required number of nodes in cluster
@saggineumann
saggineumann / bags_interection
Created March 27, 2014 09:55
Set operations on Pig Bags
outputSchema "bag:{tuple:()}"
def bags_interection bag1, bag2
return nil if bag1.nil?
return nil if bag2.nil?
bag = bag1.map{ |x| x } & bag2.map{ |x| x }
db = DataBag.new
bag.each { |x| db.add(x) }
db
end