Skip to content

Instantly share code, notes, and snippets.

View belgareth's full-sized avatar
👓
Aut iveniam viam aut faciam

Ben T. K belgareth

👓
Aut iveniam viam aut faciam
  • FLT
  • mars
View GitHub Profile
@danielbwa
danielbwa / list_and_download_files_through_sftp_with_php.php
Last active November 16, 2022 09:38
List and download all files in a directory through sftp with php / ssh2. In my example i use scandir to list the files and ssh2_scp_recv to grab a file. I've found a lot of examples using fopen to grab the remote file, that didn't work for me and i found the code below cleaner than the fopen option. For an example on how to do the same as my exa…
<?php
$username = "your_username";
$password = "your_pass";
$url = 'your_stp_server_url';
// Make our connection
$connection = ssh2_connect($url);
// Authenticate
@kampfgnu
kampfgnu / mkvextractTracks.sh
Last active March 13, 2024 05:19
batch extract subtitles from mkv files
#!/bin/bash -e
# a script that extracts the subtitle file of every mkv movie file and saves it with the same name
# copy to the folder where the mkv files live and run "./mkvextractTracks.sh" in terminal
# options: [trackID]
# example: ./mkvextractTracks.sh 1
#
# info:
# mkvextract is used to extract the subtitles, so mkvtoolnix app (which contains the mkvextract binary) is used:
# https://mkvtoolnix.download/downloads.html
@belgareth
belgareth / a way to download the latest files using PHP through SFTP (SSH2)
Last active June 5, 2017 10:06
Tried this code to retrieve the newest files from a server using php/ ssh2. The problem is that it only downloads one file instead of multiple files. Any help would be appreciated .
#!/usr/bin/php
<?php
$username = "username";
$password = "passwor";
$url = 'adress';
// Make our connection
$connection = ssh2_connect($url);
// Authenticate