Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Osman Taha Mrjavaci

🎯
Focusing
View GitHub Profile
@Mrjavaci
Mrjavaci / backup.sh
Last active Oct 17, 2022
Gitlab backup to remote ftp upload
View backup.sh
USERNAME="USERNAME"
PASSWORD="PASSWORD"
SERVER="IP_ADDRESS"
PORT="FTP/SFTP PORT"
REMOTEDIR="REMOTE_DIR"
TYPE=2 # 1 -> ftp 2 -> sftp
FILE=$(find /var/opt/gitlab/backups/ -type f -printf "%p\n" | sort -n | tail -1)
echo $FILE
@Mrjavaci
Mrjavaci / WebpConvert.php
Created Jan 27, 2022
PHP Convert and Compress Webp All Image Files (Recursive) in Folder
View WebpConvert.php
<?php
function getDirContents($dir, &$results = array()) {
$files = scandir($dir);
foreach ($files as $key => $value) {
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
if (!is_dir($path)) {
$results[] = $path;
} else if ($value != "." && $value != "..") {
@Mrjavaci
Mrjavaci / PreventSleep.cs
Created Oct 4, 2021 — forked from brianhassel/PreventSleep.cs
Prevent Computer Sleep in C#
View PreventSleep.cs
internal static class NativeMethods {
public static void PreventSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous | ExecutionState.EsSystemRequired);
}
public static void AllowSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous);
}