Skip to content

Instantly share code, notes, and snippets.

View jeansymolanza's full-sized avatar

Jeansy Molanza jeansymolanza

View GitHub Profile
#!/bin/bash
directory="/path/to/directory" # Specify the directory path
output_file="/path/to/output/file.txt" # Specify the output file path
# Get the current date in the desired format
current_date=$(date +%y%m%d)
# Clear the output file if it exists
> "$output_file"
#!/bin/bash
# Wrapper script to run commands with simulated interactive activity
# Command and arguments to run
CMD="$@"
# Function to simulate interactive activity
keep_alive() {
while true; do
#!/bin/bash
# Description: This script performs an incremental copy of files and directories
# from a source directory to a target directory, maintaining the relative directory
# structure, based on a specified time range in hours. The copy operation is
# parallelized, capable of handling multiple files and directories simultaneously.
# The script is useful for backing up or synchronizing large datasets with changes
# limited to a specific period.
#
# Usage: ./g1_incremental_copy.sh <source_dir> <target_dir> <time_range_in_hours> [number_of_processes]
#!/bin/bash
num_threads=<num_threads>
pattern_file="pattern_list.txt"
output_file="output.txt"
directory_path="directory_path"
# Read each pattern from the pattern file
while IFS= read -r pattern; do
# Run grep in the background for each pattern
sub CreateFile {
printLog("Started creating file", "MAIN");
open INFILE, $rds_file or die("Failed to open $rds_file ($!)");
$outfile = "Sudthome/batch/logs/fx_rate_bcp_load_" . time . "out";
open (my $Sout, ">", $outfile) or printSyslog("Failed to open BCP out file $outfile");
while (<INFILE>) {
chomp;
$row = $_;
$row = EscapeSpecialCharacters($row);
$rows++;
RANDOM_SECONDS=$((RANDOM % 60))
DATE_WITH_RANDOM_SECONDS=$(date -d "+${RANDOM_SECONDS} seconds" "+%Y%m%d%H%M%S")
=DATE(RIGHT(B1,4),MID(B1,4,2),LEFT(B1,2)) + TIME(MID(B1,12,2),MID(B1,15,2),MID(B1,18,2))
padded_number=$(printf "%02d" "${string//[!0-9]}")
ps -eo pid,etime,comm,user | awk '{if ($3 ~ /KL/ || $3 ~ /kl/ && $2>604800) print $1, $4}' | while read pid user; do kill $pid; echo "Killed $pid process owned by $user which started running at $(ps -o lstart= -p $pid)" >> processes.txt; done
<div>
<label for="email" class="block text-sm font-medium text-gray-700">Search candidates</label>
<div class="mt-1 flex rounded-md shadow-sm">
<div class="relative flex items-stretch flex-grow focus-within:z-10">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<!-- Heroicon name: solid/users -->
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path d="M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z" />
</svg>
</div>