Skip to content

Instantly share code, notes, and snippets.

View mavaddat's full-sized avatar
🏠
Working from home

Mavaddat Javid mavaddat

🏠
Working from home
View GitHub Profile
@mavaddat
mavaddat / Backup_cpanel.sh
Created September 29, 2017 06:05 — forked from osrecio/Backup_cpanel.sh
Get Backup Cpanel ( Files & DB's )
#!/bin/bash
LOG="/path_to_save_logs"
echo "Start backup web `date`" >> $LOG
cd /folder_to_save
FECHAF=`date +%Y.%m.%d`
mkdir $FECHAF
cd $FECHAF
FECHA=`date +%-m-%-d-%Y`

Keybase proof

I hereby claim:

  • I am mavaddat on github.
  • I am mavaddat (https://keybase.io/mavaddat) on keybase.
  • I have a public key whose fingerprint is A0F1 C894 5FA0 3F0A 40AB B121 9667 69C3 1FD6 37A1

To claim this, I am signing this object:

@mavaddat
mavaddat / deleteEmptyOrOPFOnlyDirs.ps1
Last active February 19, 2019 02:24
This script recursively deletes e-book library directories that have no books in them. It does this by checking for empty directories or directories with only OPF files in them. It then runs again to check for empty directories (to include the directories it may have just emptied).
$ebookLibraryPath = '.\OneDrive\Documents\Ebook Library\'
Function Get-Empties {
PARAM($targetPath)
Return Get-ChildItem -Path $targetPath -Recurse | Where { $_.PsIsContainer -eq $true } | Where { $_.GetDirectories().Count -eq 0 -and ($_.GetFiles().Count -eq 0) -or ($_.GetFiles().Count -eq 1 -and $_.GetFiles().Name -match "(?i)(.*?)\.opf$")}
}
$failed = @{}
$toEmpty = Get-Empties $ebookLibraryPath
Function Write-Log {
Param ( [parameter(Mandatory=$true,
@mavaddat
mavaddat / download-latest-release.ps1
Last active June 26, 2019 17:08 — forked from MarkTiedemann/download-latest-release.ps1
Download latest dotnet/codeformatter from GitHub release via Powershell
# Download latest dotnet/codeformatter release from github
$repo = "dotnet/codeformatter"
$file = "CodeFormatter.zip"
$releases = "https://api.github.com/repos/$repo/releases"
Write-Host Determining latest release
$tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name
@mavaddat
mavaddat / .gitignore
Created July 12, 2019 19:28 — forked from VonC/.gitignore
Simple download and installation script, which can be called from the cloud
/senv.sublime-*
/WindowTabsSettings.txt
@mavaddat
mavaddat / Java-CompileRun.ps1
Last active September 7, 2019 01:50
This creates a parameterized PowerShell function for compiling and running Java applications in .java files.
function Java-CompileRun {
Param(
[Parameter(Mandatory=$true)]
[String]
$javaFile,
[Parameter(Mandatory=$false)]
[String]
$path=$PWD,
[Parameter(Mandatory=$false)]
[String]
@mavaddat
mavaddat / getDependencies.ps1
Last active October 16, 2019 02:59
Preliminary version of a PowerShell script to get the .jar dependencies for a java build
function Get-Dependencies {
[CmdletBinding()]
param (
[Alias("CP", "ClassPath")]
[Parameter(Mandatory = $false)]
[string] ${Class-Path} = "F:\lwjgl-release-3.2.3-custom\",
[Alias("File", "JavaFile", "Target")]
[Parameter(Mandatory = $true)]
${Target-JavaFile}
@mavaddat
mavaddat / compileRun.sh
Last active November 23, 2019 23:27
This implements a bash function (GNU Bash or Bourne-again shell) that compiles and runs a target java class (with attendant .java file). It assumes your target exists somewhere in $GITHUB_PATH
#!/bin/bash
readonly GITHUB_PATH=~/Documents/GitHub
function compileRun () {
r () {
if [ $1 -eq 0 ]
then #compiled successfully
java $2
return 0
else #compile failed
@mavaddat
mavaddat / exampleAfter.srt
Last active January 18, 2020 01:13
Regular expression to remove redundant captioning in extracted captions from YouTube videos. The search is in regex. The replacement group is $2. The target caption file should be in SRT format. SubRip Subtitle files (SRT) are plain-text files that contain subtitle information. They include start and stop times next to the subtitle text, ensurin…
1
00:00:01,168 --> 00:00:02,702
INSTALL A LOYALIST AS THE
2
00:00:02,703 --> 00:00:03,703
DIRECTOR OF NATIONAL
3
00:00:03,704 --> 00:00:04,904
@mavaddat
mavaddat / Ask-YesOrNo.ps1
Created January 30, 2020 22:51
Ask user for confirmation. Function allows you to ask for confirmation. It is written by @hugopeeters
# Description: Ask a user to answer a question with either yes or no.
# Example use:
# If (Ask-YesOrNo)
# {
# # User has confirmed
# ...
# }
# Else
# {