Skip to content

Instantly share code, notes, and snippets.

View vijinho's full-sized avatar

Vijay vijinho

  • England
View GitHub Profile
@vijinho
vijinho / rclonedlna.service
Created September 20, 2020 22:19
Example rclone dlna startup service script on ubuntu/popos. place in "/etc/systemd/system/rclonedlna.service" then "systemctl daemon-reload" then "systemctl enable rclonedlna.service" and it should be up on next reboot.
[Unit]
Description=rclone dlna service
Documentation=man:rclone(1)
After=network.target auditd.service
[Service]
ExecStart=rclone serve dlna --addr :8080 \
--vfs-cache-mode full \
--vfs-cache-max-age 60m \
--vfs-cache-max-size 32768 \
@vijinho
vijinho / rcloned.service
Last active September 20, 2020 21:22
Simple example of running an rcloned sftpd service on ubuntu/popos. place in "/etc/systemd/system/rcloned.service" then "systemctl daemon-reload" then "systemctl enable rcloned.service" and it should be up on next reboot.
[Unit]
Description=rclone sftp service
Documentation=man:rclone(1)
After=network.target auditd.service
[Service]
ExecStart=rclone serve sftp --no-auth --addr :2022 \
--vfs-cache-mode full \
--vfs-cache-max-age 10m \
--vfs-cache-max-size 32768 \
@vijinho
vijinho / win10backup.sh
Created September 17, 2020 20:55
Simple backup script to backup a Windows 10 installation (EFI or MBR) using the /dev/ name, e.g. if on sda run "sh win10backup.sh sda"
# Simple backup script to backup a Windows 10 installation (EFI or MBR) using the /dev/ name, e.g. if on sda run "sh win10backup.sh sda"
PART=$1
date
echo "Saving partition map of ${PART}..."
fdisk -l /dev/${PART} > ${PART}.fdisk
cat ${PART}.fdisk
echo "Saving boot sector of ${PART}..."
dd bs=2048 count=1 if=/dev/${PART} of=${PART}.mbr
@vijinho
vijinho / fstab
Last active September 17, 2020 21:33
/etc/fstab example with different filesystems
# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=XXXX-XXXX /boot/efi vfat umask=0077,x-gvfs-show,x-gvfs-name=EFI 0 0
UUID=XXXXX /mnt/f2fs f2fs rw,relatime,lazytime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,fsync_mode=posix,background_gc=on,user_xattr,x-gvfs-show,x-gvfs-name=PopOs 0 0
UUID=XXXXX /mnt/ext4 ext4 nofail,noatime,nodiratime,discard,commit=90,max_batch_time=50022,min_batch_time=5000,journal_ioprio=0,errors=remount-ro,x-gvfs-show,x-gvfs-name=data 0 0
UUID=XXXX-XXXX /mnt/exfat exfat nofail,noatime,nodiratime,rw,allow_utime=2,nosuid,nodev,umask=0022,dmask=0022,uid=1000,gid=1000,user,x-gvfs-show,x-gvfs-name=data 0 0
UUID=XXXXXXXXXXXXXX /mnt/ntfs ntfs-3g nofail,rw,relatime,umask=0022,user_id=1000,group_id=1000,user,allow_other,big_writes,lazytime,windows_names,noatime,nodiratime,x-gvfs-show,x-gvfs-name=data2-ntfs,nosuid,nodev
@vijinho
vijinho / ext4defrag.sh
Created September 4, 2020 19:02
defrag ext4 filesystem
umount $1
fsck.ext4 -v -F -f -p -D -E inode_count_fullmap,optimize_extents, $1
mount $1
@vijinho
vijinho / ext4badblocks.sh
Created September 4, 2020 19:02
Check for bad blocks on ext4 filesystem
umount $1
fsck.ext4 -f -c -k -p -t -v -D -E inode_count_fullmap $1
mount $1
@vijinho
vijinho / markdown_escape.php
Last active February 26, 2024 14:28
Escape markdown in php
<?php
/**
* Escape markdown text
*
* @param string $text the markdown text to escape
*
* @return string escaped text
*/
function markdown_escape($text) {
return str_replace([
@vijinho
vijinho / setmacoshostname.sh
Created March 11, 2020 16:52
set MacOS hostname, computername: setmacoshostname.sh MyComputerName
sudo scutil --set HostName $1
sudo scutil --set LocalHostName $1
sudo scutil --set ComputerName $1
dscacheutil -flushcache
@vijinho
vijinho / adb-backup.sh
Last active January 12, 2020 13:23
Backup all Android apps and data using adb, excluding system apps
BACKUPFILE=`date "+%Y%m%d.%H%M%S"`.adb
adb backup -apk -obb -shared -all -nosystem $BACKUPFILE
# EXTRACT: ( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -
# RESTORE: adb restore backup.ab
@vijinho
vijinho / transliterate_files.php
Created December 25, 2019 02:48
Display transliterated files and folders to non-accented ASCII characters script - rename feature tested successfully with a filesystem of over 65,000 files - USE AT OWN RISK!
#!/usr/bin/php
<?php
// show and optionally rename files and dirs to transliterated unaccented ascii from current working folder
// 2019-12-24 Vijay Mahrra vijay@yoyo.org
// code is public domain
define('DEBUG', true); // use pre-generated file list
define('VERBOSE', true);
define('RENAME', false); // allow renaming
define('RENAME_FILES', false);