blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
4
115
path
stringlengths
2
970
src_encoding
stringclasses
28 values
length_bytes
int64
31
5.38M
score
float64
2.52
5.28
int_score
int64
3
5
detected_licenses
listlengths
0
161
license_type
stringclasses
2 values
text
stringlengths
31
5.39M
download_success
bool
1 class
d34a6709f557d7117cc2092b2bbfa86c7c171003
Shell
FOSDEM/infrastructure
/resources/video/generate-video-dns.sh
UTF-8
711
3.5
4
[ "MIT", "CC-BY-4.0", "CC-BY-2.0" ]
permissive
#!/bin/bash set -e INV='inventory.csv' PREFIX_LEN='19' main() { generate_zonefile_header echo ";;" echo fgrep ':' $INV | while read line; do host=$(echo $line | cut -d, -f2) ipv4=$(echo $line | cut -d, -f4) echo "$host IN A $ipv4" done } generate_zonefile_header() { echo '$TTL 3600' echo "@ IN SOA ns0.conference.fosdem.net. hostmaster.conference.fosdem.net. (" echo " $(generate_serial) ; serial (seconds since epoch)" echo " 600 ; refresh" echo " 300 ; retry" echo " 604800 ; expire" echo " 3600 ; default_ttl" echo " )" echo "@ IN NS ns0.conference.fosdem.net." echo "; @ IN NS ns0.conference.fosdem.net." } generate_serial() { date +%s } main
true
eefaf77524878f5fee36ed49ef99fad205f986f6
Shell
nathejk/camera
/fetch2.sh
UTF-8
744
3.515625
4
[]
no_license
#!/bin/bash WORKDIR=/camera CAMERADIR=/home/pirate/photos LASTFILE=$WORKDIR/last.jpg # first run find newesst file if [ ! -f $LASTFILE ]; then echo "finding newest" newest=`find $CAMERADIR -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2 | tail -n 1` cp $newest $LASTFILE fi NEWFILES=`find $CAMERADIR -newer $LASTFILE -type f` for newfile in $NEWFILES do echo "Resize and upload file: $newfile" convert $newfile -resize 640x480 $WORKDIR/resized.jpg # do upload curl -F upload=@resized.jpg http://natpas.nathejk.dk/upload-image.php if [ $? -eq 0 ]; then # upload succeeded cp --preserve=all $newfile $LASTFILE fi done
true
08750a75876be6642d07a4c0a62c020ef627eb6d
Shell
ntk148v/til
/openstack/openstack-heat/autoscaling/templates/auto-scaling-applications/v4/config_supervisor.sh
UTF-8
601
2.59375
3
[ "CC-BY-4.0" ]
permissive
#!/bin/sh # configure supervisor to run a private gunicorn web server, and # to autostart it on boot and when it crashes # stdout and stderr logs from the server will go to /var/log/cloud mkdir /var/log/cloud cat >/etc/supervisor/conf.d/cloud.conf <<EOF [program:cloud] command=/home/cloud/venv/bin/gunicorn -b 127.0.0.1:8000 -w 4 --chdir /home/cloud --log-file - app:app user=cloud autostart=true autorestart=true stderr_logfile=/var/log/cloud/stderr.log stdout_logfile=/var/log/cloud/stdout.log EOF supervisorctl reread supervisorctl update systemctl restart supervisor systemctl enable supervisor
true
838d81804eb973ed6a9d0042027ecd76845fd641
Shell
jsh/fedora-infrastructure
/remove-empty-directories
UTF-8
178
2.96875
3
[]
no_license
#!/bin/bash -eu die() { echo $* >&2 ; exit 1; } # am I in a git repo? git config -l | grep -s core.bare || die "$PWD not a git repo" git stash -u git clean -f -d git stash pop
true
1338ee172228347bc1249f8268c3f902523f33ea
Shell
ciarancoady98/Compiler-Design
/Assignment6/compile.sh
UTF-8
214
2.578125
3
[]
no_license
#!/bin/bash #chmod u+x hello-world echo "Please enter the name of the project to compile?" read fileName echo "Compiling $fileName" flex $fileName.l bison -d $fileName.y gcc -o output lex.yy.c $fileName.tab.c -lfl
true
53191a39890903d2e4bff05362495e12baed507d
Shell
buren/enduro
/release.sh
UTF-8
1,423
3.53125
4
[]
no_license
#!/bin/sh # Skapen en target mapp med version inläst från prompt # kopiera manual.md till target # flytta jar till target # kopiera acceptanstester till target # zip target set -e # Exit on failed command read -p "What version is this? " version_number release_name="enduro_release_v$version_number" current_dir=$(pwd) target_dir=release/release_v$version_number/ $HOME/apps/maven/apache-maven-3.0-SNAPSHOT/bin/mvn package $HOME/apps/maven/apache-maven-3.0-SNAPSHOT/bin/mvn javadoc:javadoc for i in docs/*.md; do perl docs/markdown_to_html/Markdown.pl --html4tags $i > ${i%.*}.html done; for i in docs/*.html; do converted_doc=$(cat $i) echo '<html><head><meta charset="UTF-8"></head><body>' > $i # Replace file $i content echo $converted_doc >> $i # Append $converted_doc to $i echo '</body></html>' >> $i # Append $html_end to $i done; mkdir -p $target_dir cp docs/*.html $target_dir rm docs/*.html #Remove files after being generated and copied. cp docs/*.png $target_dir cp target/*.jar $target_dir mkdir $target_dir/javadoc cp -r target/site/apidocs/* $target_dir/javadoc rm $target_dir/*with-dependencies.jar cp -r src/test/resources/acceptanstester/ $target_dir zip -r $release_name $target_dir mv $release_name.zip $HOME/Desktop echo -e "Release name will be: '$release_name' and will be placed on your Desktop folder when done"
true
efac36ec1e9d3139634403b9d2725030d0c59728
Shell
DASPRiD/dasprids.de
/deploy.sh.dist
UTF-8
203
2.515625
3
[]
no_license
#!/bin/bash DEPLOY_USER="username" DEPLOY_HOST="hostname" DEPLOY_PATH="/path/to/website/" cd "${0%/*}" composer compile rsync -avz --progress --checksum dist/* "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH"
true
3f081b10c74153b6fbf1437f01b8bb262fd01221
Shell
metcalf/env-conf
/files/bin/git-delete-squashed
UTF-8
456
3.625
4
[]
no_license
#!/bin/bash set -e [[ "$1" = "-f" ]] && PREF="" || PREF="echo " CURRENT=$(git rev-parse --abbrev-ref HEAD) if [ "$CURRENT" != "master" ]; then echo "error: not on master!" exit 1 fi git for-each-ref refs/heads/ "--format=%(refname:short)" | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == "-"* ]] && git branch -D $branch done
true
5b6e04dcfc7c496daa688062a3912cad6d878779
Shell
Zhiqin-HUANG/RNAseqPipe
/run_star.sh
UTF-8
12,045
3.3125
3
[]
no_license
#! /bin/bash #PBS -l nodes=1:ppn=15 #PBS -l mem=48g #PBS -l walltime=35:00:00 #PBS -M z.huang@dkfz.de #PBS -m a #PBS -j oe source /home/huangz/scripts_tmp/config.sh # constant defined by config.sh #star="/ibios/tbi_cluster/11.4/x86_64/bin/STAR" #rseqc="/icgc/lsdf/mb/analysis/huang/software/RNA-SeQC_v1.1.7.jar" #check the reference genome fasta, which has the same order as in aligned.bam #ref="/icgc/dkfzlsdf/analysis/hipo_017/reference/1K_genome/hs37d5.fa" #encode_gtf="/icgc/dkfzlsdf/analysis/hipo_017/reference/gencode.v19.annotation_noChr.gtf" #picard="/icgc/dkfzlsdf/analysis/hipo_017/scripts/picard.sh" #rRNA="/icgc/dkfzlsdf/analysis/hipo_017/reference/human_rRNA/human_all_rRNA.fasta" #genomeDir="/icgc/dkfzlsdf/analysis/hipo_017/reference/star_gencodeV19_noChr_len101" # platform #rgPL="Hiseq" # library ID #rgLB="ssRNA" ## output folder # results is located in folder without "/" end. Per sample results will be generated in result_path. #results="/icgc/dkfzlsdf/analysis/hipo_016/results_per_pid" results=$results_path #-----parsing parameters----# #----------Begin------------# # left reads, if > 1 files, combined with ',' # e.g. left_01_R1,letf_02_R1 right_01_R2,right_02_R2 read1=$leftReads # right reads, same as left reads, the order must be corresponding. read2=$rightReads echo "input rawData: " $read1 $read2 #-----extract sample ID and read group ID-----# # 1. extract single fule file name f_name=`echo $read1 | awk '{split($0,array,","); print array[1]}'` # 2. extract only file name without path bn=$(basename ${f_name[0]}) # replace "_" with "-" base=${bn//_/-} # 3. extract sample ID, splited by "-" IFS="-" arr=($base) smID=${arr[0]}_${arr[1]}_${arr[2]}_${arr[3]} # 4. extract read group ID rgID=${arr[0]}_${arr[2]}_${arr[3]} #---extract flow cell ID and barcode as platform unit---# title=`gunzip -c "$f_name" | head -n 1` IFS=":" arr2=($title) lenTitle=`expr ${#arr2[@]} - 1` barcode=`echo ${arr2[2]}_${arr2[${lenTitle}]} | sed 's/\s//g'` #----------End-------------# #==========================# #----create ouput dir for the sample-----# #--if it is existed, do nothing and exit--# #--------Begin-------# # define the output name output="$results/$smID" if [ -d "$output" ];then echo ">>>> Warning: $output is already there. Please check it..." >&2 else mkdir $output fi # for star mapping preparation cd $output #--------End---------# #### make star output folder # Each STAR run should be made from a fresh working directory. All the output files are stored in the working # directory. The output files will be overwritten without a warning every time you run STAR. # results is located in folder without "/" end: starOut=$output/star if [ -d "$starOut" ];then # echo ">>>> Warning: $starOut is already there. " >&2 echo ">>>> Warning: $starOut is already there." #exit 1 else mkdir $starOut fi #-----------CHECK-----------# # check following parameters before running #check the reference genome fasta, which has the same order as in aligned.bam #ref="/icgc/dkfzlsdf/analysis/hipo_017/reference/1K_genome/hs37d5.fa" buffer="/ibios/tbi_cluster/11.4/x86_64/bin/mbuffer" # htseq-count script, Server is updated # htseqCount="/icgc/lsdf/mb/analysis/huang/software/htseq-count.py" # number of threads p=10 # shared memory strategy gLoad=LoadAndRemove # number of mismatches by default is 10. mis=2 # number of minimum matched basese, default 0. minBM=0 # min intron size, default to 21 intronMin=21 # SAM attributes, --outSAMattributes attribute=Standard echo ">>> Annotation GTF: $encode_gtf" echo ">>> STAR Index: $genomeDir" echo ">>> Genome reference: $ref" echo ">>> rRNA reference: $rRNA" cd $starOut if [ ! -s $starOut/Aligned.out.rg.bam ];then $star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | $picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=/dev/stdin OUTPUT=$starOut/Aligned.out.rg.bam RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate MAX_RECORDS_IN_RAM=8000000 echo "$star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | $picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=/dev/stdin OUTPUT=$starOut/Aligned.out.rg.bam RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate MAX_RECORDS_IN_RAM=8000000" fi # check whether the output file exists or empty if [ -s $starOut/Aligned.out.rg.bam ];then touch $starOut/finish_star fi # -limitIObufferSize, max available buffers size (bytes) for input/output, per thread # --outFilterIntronMotifs , RemoveNoncanonical or RemoveNoncanonicalUnannotated. Or default ##### Run STAR ##### #$star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | $buffer -m 3G -q | samtools view -S -b - > $starOut/Aligned.out.bam #$star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | $picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=/dev/stdin OUTPUT=$starOut/Aligned.out.rg.bam RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate MAX_RECORDS_IN_RAM=8000000 #$star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | $picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=/dev/stdin OUTPUT=/dev/stdout RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate MAX_RECORDS_IN_RAM=6000000 > $starOut/Aligned.out.rg.bam #command1="$star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | samtools view -S -b - > $starOut/Aligned.out.bam" #command1="$star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | $picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=/dev/stdin OUTPUT=$starOut/Aligned.out.rg.bam RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate MAX_RECORDS_IN_RAM=8000000" #command1="$star --runMode alignReads --genomeDir $genomeDir --alignIntronMin $intronMin --outFilterMatchNmin $minBM --readFilesIn $read1 $read2 --readFilesCommand zcat --outFilterMismatchNmax $mis --runThreadN $p genomeLoad $gLoad --limitGenomeGenerateRAM 31000000000 --limitIObufferSize 150000000 --outSAMattributes $attribute --outFilterIntronMotifs RemoveNoncanonical --outSAMunmapped Within --outStd SAM | $picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=/dev/stdin OUTPUT=/dev/stdout RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate MAX_RECORDS_IN_RAM=6000000 > $starOut/Aligned.out.rg.bam" #echo "$command1" <<comment_huang #-----parsing parameters for RSeQC----# #----------Begin------------# # platform rgPL="Hiseq" # library ID rgLB="trueSeq" #-----extract sample ID and read group ID-----# # 1. extract only file name without path bn=$(basename "${read1}") # replace "_" with "-" base=${bn//_/-} # 2. extract sample ID, splited by "-" IFS="-" arr=($base) smID=${arr[0]} # 3. extract read group ID rgID=${arr[0]}_${arr[1]} #---extract 'flow cell ID and barcode' as platform unit---# # barcode may not be there # do remove all space, Jan 22,2015 title=`gunzip -c "${read1}" | head -n 1` barcode=`echo $title | awk '{split($0,a,":");print a[3]}' | sed 's/\s//g'` #title=`head -n 1 "${read1}"` #IFS=":" #arr2=($title) #lenTitle=`expr ${#arr2[@]} - 1` #barcode=`echo ${arr2[2]}_${arr2[${lenTitle}]} | sed 's/\s//g'` #----------End-------------# #==========================# # define a temporty file for large inter-sam file # tmpDir="/cb0806/huang/tmp/" if [ ! -e "${starOut}/Aligned.out.sam" ];then echo "${starOut}/Aligned.out.sam doesn't exist there, program exits..." exit 1 fi output=$starOut # add read group information, sorted by coordinate, output bam echo ">>>> Add read group information, sorted by coordinate, output .bam" echo "$picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=$output/Aligned.out.sam OUTPUT=$output/Aligned.out.rg.sam RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate" $picard AddOrReplaceReadGroups TMP_DIR=$tmpDir INPUT=$output/Aligned.out.sam OUTPUT=$output/Aligned.out.rg.sam RGID=$rgID RGSM=$smID RGLB=$rgLB RGPU=$barcode RGPL=$rgPL VALIDATION_STRINGENCY=SILENT VERBOSITY=ERROR SORT_ORDER=coordinate MAX_RECORDS_IN_RAM=3000000 # TMP_DIR=$tmpDir # conver sam file to bam echo "samtools view -b -S $output/Aligned.out.rg.sam -o $output/Aligned.out.rg.bam" samtools view -b -S $output/Aligned.out.rg.sam -o $output/Aligned.out.rg.bam # run picard, preprocessed, mark duplicates and create index, MD5 echo ">>>> makr duplicates, create index..." $picard MarkDuplicates INPUT=$output/Aligned.out.rg.bam OUTPUT=$output/Aligned.out.rg.dupFlag.bam METRICS_FILE=$output/picard_markDuplicates_metrics CREATE_MD5_FILE=true CREATE_INDEX=true VALIDATION_STRINGENCY=SILENT MAX_RECORDS_IN_RAM=3000000 VERBOSITY=ERROR TMP_DIR=$tmpDir # rename index file echo ">>>> Rename .bai file..." mv $output/Aligned.out.rg.dupFlag.bai $output/Aligned.out.rg.dupFlag.bam.bai rseqcOut=$output/RSeQC_star # ## run RSeQC software, the standard output and error will be deleted by "&> /dev/null" echo ">>>> Run RSeQC package..." echo "java -jar $rseqc -o $rseqcOut -s \"$smID\|$output/Aligned.out.rg.dupFlag.bam\|$rgLB\" -r $ref -t $encode_gtf -transcriptDetails -gatkFlags -U ALLOW_SEQ_DICT_INCOMPATIBILITY -BWArRNA $rRNA &> /dev/null" # exe RSeQC java -jar $rseqc -o $rseqcOut -s \"$smID\|$output/Aligned.out.rg.dupFlag.bam\|$rgLB\" -r $ref -t $encode_gtf -transcriptDetails -gatkFlags -U ALLOW_SEQ_DICT_INCOMPATIBILITY -BWArRNA $rRNA #&> /dev/null comment_huang
true
1dfbb349f3fb8abf7c2c2d37361391ef421397bd
Shell
kekusss/Systemy-Operacyjne-2
/lab2/script2.sh
UTF-8
700
4.0625
4
[]
no_license
#!/bin/bash -eu set +u FOLDER=${1} FILE=${2} set -u #RCs DIR_NOT_EXIST=10 INCORRECT_NUM_ARGS=11 if ! [[ "$#" -eq "2" ]]; then echo "an incorrect number of arguments were supplied" exit "${INCORRECT_NUM_ARGS}" fi if ! [[ -d "$FOLDER" ]]; then echo "${FOLDER} is not valid path to folder" exit "${DIR_NOT_EXIST}" fi if ! [[ -f "$FILE" ]]; then echo "${FILE} is not valid path to regular file" exit "${DIR_NOT_EXIST}" fi FILE_LIST=$(ls ${FOLDER}) DATE=$(date +'%Y-%m-%d') for ITEM in ${FILE_LIST}; do if [[ -L "${FOLDER}/${ITEM}" ]] && [[ ! -e "${FOLDER}/${ITEM}" ]] ; then rm "${FOLDER}/${ITEM}" echo ${DATE} : ${ITEM} $'\n' >> ${FILE} fi done
true
3c3431181e9b76b19d7a3846fa1113d4233a8955
Shell
cvasani/dotfiles
/default-programs/media-aliases.zsh
UTF-8
1,083
2.90625
3
[ "MIT" ]
permissive
# set default programs to open files # just type filename if a supported filetype # TODO: write this as per-system, so can do differently for osx # alias -s pdf=xpdf alias -s mat=octave # I set up a separate $DEFAULTEDITORFAULTEDITOR so I can change it on the fly without # affecting other editor calls # let me choose which editor on the fly function change-default-editor() { export DEFAULTEDITOR=$1 alias -s zsh=$DEFAULTEDITOR txt=$DEFAULTEDITOR sh=$DEFAULTEDITOR py=$DEFAULTEDITOR m=$DEFAULTEDITOR rst=$DEFAULTEDITOR alias -s down=$DEFAULTEDITOR markdown=$DEFAULTEDITOR md=$DEFAULTEDITOR } function remove-default() { unalias -s $1 } # doesn't remove pdf or octave function remove-all-defaults() { unalias -s zsh txt sh py m down markdown md } # set our initial editor as vim alias usegvim="change-default-editor gvim" alias usevim="change-default-editor vim" alias usegedit="change-default-editor gedit" alias usemvim="change-default-editor mvim" # use octave to open .mat files if nothing else selected alias radef="remove-all-defaults" alias rd="remove-default"
true
cfd35bd2b996a28bf9dc28b766bc1debbaa80d02
Shell
if362005/HiFPTuner
/precimonious/scripts/search.sh
UTF-8
630
3.46875
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
#!/bin/bash # ############################################################# # Shell script to create search file for a given program # Use: ./search.sh name_of_bc_file # ############################################################# sharedLib=$CORVETTE_PATH"/src/Passes.so" arch=`uname -a` name=${arch:0:6} if [ "$name" = "Darwin" ]; then sharedLib=$CORVETTE_PATH"/src/Passes.dylib" fi varFlags="--only-arrays --only-scalars --funs" echo "Creating search file search file" search_$1.json opt -load $sharedLib -search-file --original-type $varFlags $1.bc --filename search_$1.json > $1.tmp # cleaning up rm -f $1.tmp
true
d6251037cc8ec2f3080f2936b21020061114d3fd
Shell
doronbehar/.config_nvim
/add-plugin.sh
UTF-8
898
3.59375
4
[]
no_license
#!/bin/sh set -e if [ $# -lt 2 ]; then echo usage: $0 '<clone URL>' '<category directory in pack/>' '<directory name in bundle/>' echo last argument is optional - if not given, it\'ll be infered from the 2nd exit 2 fi if [[ -z "$3" ]]; then plugin_name_stripped=${1##*/} plugin_name_stripped=${plugin_name_stripped#vim-} plugin_name_stripped=${plugin_name_stripped#nvim-} green=$(tput setaf 2) reset=$(tput sgr0) echo The plugin will be named $green"$plugin_name_stripped"$reset inside bundle and pack/$2/ echo Are you O.K with that? Press '<C-c>' to abort read else plugin_name_stripped="$3" fi plugindir="pack/"$2"/start/$plugin_name_stripped" echo @@@ Cloning... echo git submodule add "$1" "$plugindir" git submodule add "$1" "$plugindir" echo @@@ updating help tags echo nvim -es --cmd "helptags $plugindir/doc" --cmd "quit" nvim -es --cmd "helptags $plugindir/doc" --cmd "quit"
true
6b09d77a15c80bd97399735dca8d727d71dadda3
Shell
markchalloner/vagrant-ubuntu-trusty
/ansible/bin/all.sh
UTF-8
213
3.09375
3
[]
no_license
#!/usr/bin/env bash # Remount bind mounts mounts= for i in $(mount | grep bind | sed 's#^.* on \([^ ]\+\).*$#\1#g') do mounts="${mounts} ${i}" done sudo -- sh -c "umount ${mounts} > /dev/null 2>&1; mount -a"
true
70545c86414096a66f8a318fde93c2b8d08dc834
Shell
cla473/DS_CanolaTillingPopulation
/scripts/LC_test.sh
UTF-8
890
3.171875
3
[]
no_license
#!/bin/bash #SBATCH --job-name=run_bwa_alignment #SBATCH --time=01:00:00 #SBATCH --nodes=1 #SBATCH --ntasks-per-node=10 #SBATCH --mem=10g # For Submission: # INDIR="/OSM/CBR/AF_DATASCHOOL/output/2018-05-03_canola/BWA" # GENOME="/OSM/CBR/AF_DATASCHOOL/input/ref_genome/GCF_000686985.2_Bra_napus_v2.0_genomic.fasta" # NUM=$(expr $(ls -1 ${INDIR}/*.fastq.gz | wc -l) - 1) # sbatch -a 0-$NUM --export INDIR="$INDIR" --export GENOME="$GENOME" LC_GATK.sh OUTDIR= echo ` ${INDIR} | sed -r 's/BWA/gatk/g' ` if [ -d "$INDIR" ] then SAMPLES=( `ls -1 ${INDIR}/*.fastq.gz` ) if [ ! -z "$SLURM_ARRAY_TASK_ID" ] then i=$SLURM_ARRAY_TASK_ID echo `sample ${SAMPLES[$i]}.txt > ${OUTDIR}/LC_log.text else echo "Error: Missing array index as SLURM_ARRAY_TASK_ID" fi else echo "Error: Missing input file directory as --export env INDIR or doesn't exist" fi
true
fc3670062a6bbea4f71bb1266fd837deeeab1371
Shell
ibanez270dx/dotfiles-old
/bash/functions
UTF-8
5,562
4.0625
4
[]
no_license
#!/bin/bash ########################### # Funny Or Die ########################### function fod { cd "${HOME}/Dev/funnyordie" if [[ $1 == "restart" || $1 == "r" ]]; then sudo powify server restart elif [[ $1 == "p" || $1 == "periodic" ]]; then ${HOME}/Dev/funnyordie/script/runner Periodic::Manager.run elif [[ $1 == "t" || $1 == "tail" ]]; then tail -f "${HOME}/Dev/funnyordie/log/development.log" elif [[ $1 == "staging" ]]; then ssh_color_wrapper capistrano@172.16.160.168; fi } ########################### # Ruby ########################### # pass rails version: # uninstall_all_gems 2.2.2 uninstall_all_gems() { list=`gem list --no-versions` for gem in $list; do gem uninstall ${1} $gem -aIx done gem list } ########################### # Chrome Extensions ########################### function copy-chrome-extension { if [ -n "$1" ]; then local name=${1}; # optionally name the destination folder if [ -n "$2" ]; then name=${2}; fi # copy if the destination folder doesn't exist if [ ! -d "${HOME}/Dev/ChromeExtensions/${name}" ]; then echo "copying ${1} to Dev/ChromeExtensions/${name} ..." cp -R ${HOME}/Library/Application\ Support/Google/Chrome/Default/Extensions/${1} ${HOME}/Dev/ChromeExtensions/${name} fi fi } ########################### # MySQL ########################### # Backup a table. Defaults to *_backup, # pass additional argument for *_whatever. function backup_table { local t1=${1} local t2=${1}_${2:-backup} rails db << EOF \! echo "dropping $t2 if it exists..." drop table if exists $t2; \! echo "creating $t2..." create table $t2 like $t1; \! echo "copying $t1 to $t2..." insert into $t2 select * from $t1; \! echo "Done!" select count(*) from $t2; EOF } # Restore a table function restore_table { local t1=${1} local t2=${1}_${2:-backup} rails db << EOF \! echo "dropping $t1..." drop table $1; \! echo "creating $t1..." create table $t1 like $t2; \! echo "copying $t2 to $t1..."; insert into $t1 select * from $t2; \! echo "Done!" select count(*) from $t1; EOF } ########################### # Utility ########################### # Replaces whitespaces with underscores for # every file in the specified directory. function replace_whitespace { local renamed=0 if [ "${1}" ] && [ -d "${1}" ]; then for filename in "${1}"/*; do echo "${filename}" | grep -q " " if [ $? -eq 0 ]; then mv "${filename}" $(echo "${filename}" | sed -e "s/ //g") let renamed+=1 fi done echo "${renamed} file(s) renamed." else echo "Invalid path." fi } # Toggle hidden file visiblity in finder windows. function toggle_hidden_files { local status=$(defaults read com.apple.finder AppleShowAllFiles) if [ $status == YES ]; then defaults write com.apple.finder AppleShowAllFiles NO else defaults write com.apple.finder AppleShowAllFiles YES fi killall Finder } # Use web API to minify files passed in. # Only works w/ javascript files ATM. function minify { if [ $# -eq 0 ]; then echo "No arguments supplied." echo "Usage: > minify myscript.js" elif [ -e ${1} ]; then file=(${1//./ }) if [ ${file[1]} == 'js' ]; then echo "Minifying Javascript file... " curl -X POST -s --data-urlencode "input@${file[0]}.js" http://javascript-minifier.com/raw > ${file[0]}.min.js fi else echo "Couldn't find ${1}" fi } ########################### # AppleScripts ########################### # Change the background color of the current # terminal window. Useful for distinguishing # different servers using SSH. function iterm_bg { local R=$1 local G=$2 local B=$3 local A=`ruby -e "print 1.0 - $4"` /usr/bin/osascript <<EOF tell application "iTerm" tell the current terminal tell the current session set background color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255))} set transparency to "$A" end tell end tell end tell EOF } function iterm_fg { local R=$1 local G=$2 local B=$3 /usr/bin/osascript <<EOF tell application "iTerm" tell the current terminal tell the current session set foreground color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255))} end tell end tell end tell EOF } # Create a Notification Center notification (top right of screen). # EX: notify_me "Humani.se Down", "Can't ping... destination host unreachable." function notify_me { /usr/bin/osascript <<EOF display notification "${2}" with title "${1}" EOF } ########################### # Dotfiles ########################### # TODO: link function # * should comment out all bash initialization scripts and source the .dotfile version # TODO: unlink function # * should remove sourcing of .dotfile initializers and uncomment bash initialization scripts function dotfiles { if [[ $1 == "link" ]] then timestamp=$(($(date +'%s * 1000 + %-N / 1000000'))) for dotfile in $DOTFILES/config/*; do local target="${HOME}/.${dotfile##*/}" if [ -f $target ]; then mv $target "${target}.backup.${timestamp}" echo "${target} exists! Creating backup..." fi ln -s $dotfile $target echo -e "${dotfile##*/} linked successfully\n" done elif [[ $1 == "unlink" ]] then echo "todo" # Iterate through home folder to find backup conf files for dotfiles/config. # If exists, delete link, restore latest backup. else cd "${DOTFILES}" fi }
true
41ceda3d4c7e2ebe80491bbd304d7913aa89ea33
Shell
jneidel/dotfiles
/scripts/ftp/ftpa
UTF-8
532
3.5625
4
[]
no_license
#! /bin/bash DIR="$(dirname $0)" if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$1" = "help" ] || [ -z "$1" ]; then cat <<EOF $ ftpa FILE Add a file to my phones audio directory Parameters: \$1: file EOF exit fi command -v sftp >/dev/null || { echo "sftp is not installed"; exit 1; } command -v sshpass >/dev/null || { echo "sshpass is not installed" 1>&2; exit 127; } FILE="$1" source $DIR/ftp-base sshpass -p $SSHPASS sftp -P $PORT -oHostKeyAlgorithms=+ssh-rsa -oBatchMode=no -b - $IP << ! cd audio put $FILE !
true
5fe0c23dd73b265a4bee6d666734f92185869327
Shell
ibiqlik/argocd-slack-notification
/entrypoint.sh
UTF-8
2,883
3.671875
4
[ "MIT" ]
permissive
#!/bin/sh # Required environment variables: # ARGOCD_SERVER # ARGOCD_ADMIN_PASS or ARGOCD_TOKEN # ARGOCD_APP # ARGOCD_HOOKSTATE # SLACK_WEBHOOK_URL # SLACK_CHANNEL # Optional environment variables: # SLACK_PRETEXT if [ -z "$ARGOCD_SERVER" ] || [ -z "$ARGOCD_APP" ] || [ -z "$ARGOCD_HOOKSTATE" ] || [ -z "$SLACK_WEBHOOK_URL" ] || [ -z "$SLACK_CHANNEL" ]; then echo 'One or more of the required variables are not set' exit 1 fi # Determine if Admin pass or Token was provided if [ -z "$ARGOCD_TOKEN" ] && [ -z "$ARGOCD_ADMIN_PASS" ]; then echo "Missing ARGOCD_TOKEN or ARGOCD_ADMIN_PASS" exit 1 fi if [ ! -z "$ARGOCD_ADMIN_PASS" ]; then ARGOCD_TOKEN=$(curl -s $ARGOCD_SERVER/api/v1/session -d "{\"username\": \"admin\", \"password\": \"$ARGOCD_ADMIN_PASS\"}" | jq -r .token) fi if [ -z "$ARGOCD_TOKEN" ]; then echo "ARGOCD_TOKEN is empty" exit 1 fi if [ -z "SLACK_PRETEXT" ]; then SLACK_PRETEXT="ArgoCD" fi # Get token, or simply use it if it was provided as env var # curl -s $ARGOCD_SERVER/api/v1/applications -H "Authorization: Bearer $ARGOCD_TOKEN" > tmp.json curl -s $ARGOCD_SERVER/api/v1/applications --cookie "argocd.token=$ARGOCD_TOKEN" > tmp.json # Set app url to include in the message ARGOCD_APP_URL="$ARGOCD_SERVER/applications/$ARGOCD_APP" REVISION=$(jq -r '.items[] | select( .metadata.name == "'$ARGOCD_APP'") | .status.operationState.operation.sync.revision' tmp.json) # Get information about git repo REPO_URL=$(jq -r '.items[] | select( .metadata.name == "'$ARGOCD_APP'") | .spec.source.repoURL' tmp.json) REPO_URL=${REPO_URL%.git*} REPO_OWNER=$(echo ${REPO_URL##http**.com} | cut -d '/' -f2) REPO=$(echo ${REPO_URL##http**.com} | cut -d '/' -f3) # Set Slack color and status based on hook case $ARGOCD_HOOKSTATE in SyncFail) COLOR="danger" STATUS="error" ;; PostSync) COLOR="good" STATUS="success" ;; *) COLOR="warning" STATUS="unknown" ;; esac generate_data() { cat <<EOF { "channel": "$SLACK_CHANNEL", "attachments": [ { "title": "Application: $ARGOCD_APP", "title_link": "$ARGOCD_APP_URL", "color": "$COLOR", "pretext": "$SLACK_PRETEXT", "fields": [ { "title": "Status", "value": "$STATUS", "short": true }, { "title": "Commit", "value": "<$REPO_URL/commit/$REVISION|$REVISION>", "short": false } ], "footer": "$REPO_URL", "footer_icon": "https://github.githubassets.com/favicon.ico", "ts": $(date +%s) } ] } EOF } curl -X POST -H 'Content-type: application/json' --data "$(generate_data)" "$SLACK_WEBHOOK_URL"
true
9d4cad2fe3d3329d5491cc0eb813e361da49f770
Shell
bioconda/bioconda-recipes
/recipes/vadr/post-link.sh
UTF-8
497
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/env bash echo " Please run 'download-vadr-models.sh MODELNAME' (e.g. 'download-vadr-models.sh sarscov2') to download the models required to run VADR. These files will be downloaded to ${VADRMODELDIR}. A list of avaialble models can be found at https://ftp.ncbi.nlm.nih.gov/pub/nawrocki/vadr-models/ If you have a database in a custom path, please change the VADRMODELDIR environment variable. " >> ${PREFIX}/.messages.txt printf '%s\n' "${URLS[@]}" >> "${PREFIX}/.messages.txt" 2>&1
true
beca5ed6b4cc24f777c8832cdba10427f7927854
Shell
Flink/dokku-discourse-utils
/scripts/discourse.sh
UTF-8
1,477
3.15625
3
[]
no_license
#!/bin/bash echo "=====> Injecting tools needed for Discourse" echo "-----> Installing PostgreSQL tools" wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - > /dev/null echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list apt-get update -qq apt-get install -qq -y postgresql-client-9.5 &> /dev/null echo "-----> Installing image optimization tools" apt-get install -qq -y gifsicle ImageMagick pngquant jhead jpegoptim libjpeg-turbo-progs libjpeg-progs &> /dev/null echo "-----> Installing npm & svgo" curl -sL https://deb.nodesource.com/setup_0.12 | bash - > /dev/null apt-get install -qq -y nodejs &> /dev/null npm install -g svgo > /dev/null echo "-----> Setting .git to report correct version" cd /git COMMIT=$(git log --grep 'version.*v([0-9]\.)+' -i -E -1 --format=format:%H) git clone -q https://github.com/discourse/discourse /discourse > /dev/null cd /discourse git checkout "$COMMIT" &> /dev/null cp -a /discourse/.git /app cd /app rm -rf /discourse echo "-----> Generating proper Procfile" sed -i 's,^web.*$,web: bundle exec unicorn -c config/unicorn.conf.rb -p \$PORT,' /app/Procfile echo "-----> Modifying Unicorn configuration" sed -i 's/^stderr_path.*$//' /app/config/unicorn.conf.rb sed -i 's/^stdout_path.*$//' /app/config/unicorn.conf.rb echo "-----> Creating /app/tmp/pids directory" mkdir -p /app/tmp/pids echo "-----> Cleaning" apt-get clean -qq echo "=====> Done"
true
610b22d81138d3882e02fc57c8cf4bb0c96ee5ae
Shell
vgadreau/demo
/chef-bookbooks/D/doozer/templates/default/doozerd.init.erb
UTF-8
1,252
3.78125
4
[ "Apache-2.0" ]
permissive
#!/bin/bash # doozerd daemon # chkconfig: 4 20 80 # description: A highly available, distributed store. # processname: doozerd NAME=doozerd DAEMON_PATH='<%= @doozerd_path %>' DAEMON="$DAEMON_PATH/bin/$NAME" DAEMON_USER='<%= @doozerd_user %>' DAEMON_OPTS='<%= @doozerd_options %>' PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME LOGFILE=/var/log/$NAME.log case "$1" in start) printf "%-50s" "Starting $NAME..." PID=`$DAEMON $DAEMON_OPTS &>$LOGFILE & echo $!` [ -z $PID ] && echo "Failed!" && exit 2 echo $PID > $PIDFILE echo "OK." ;; stop) printf "%-50s" "Stopping $NAME..." [ ! -e $PIDFILE ] && echo "Not running!" && exit 3 PID=`cat $PIDFILE` [ ! -z `ps -p $PID` ] && echo "Failed!" && exit 4 kill -HUP $PID && rm -f $PIDFILE && echo "OK." ;; status) printf "%-50s" "Checking $NAME..." [ ! -e $PIDFILE ] && echo "Stopped!" && exit 0 PID=`cat $PIDFILE` [ ! -z `ps -p $PID` ] && echo "Stopped! (fault)" && exit 5 echo "Running! ($PID)" ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {status|start|stop|restart}" exit 1 ;; esac
true
4777066c3fd818feab7476f73be5c8d3416098d0
Shell
SharifAIChallenge/AIC21-Game
/docker-ez/compiler.sh
UTF-8
3,740
4.1875
4
[]
no_license
#! /bin/bash ROOT_DIR=$PWD LOG_PATH=$ROOT_DIR/compile.log BIN_PATH=$ROOT_DIR/binary # empty log file echo "" > $LOG_PATH # takes a string and append it to the log file as well as the console tty function log { echo "$1" | tee -a $LOG_PATH } # generates info log function info { log "===[INFO]===[`date +'%F-%T'`]=== : $1" } # generates warn log function warn { log "===[WARN]===[`date +'%F-%T'`]=== : $1" } # generates FATAL log and exits with -1 function fatal { log "===[FATAL]==[`date +'%F-%T'`]=== : $1" # clean up rm -rf /home/isolated exit -1 } # check weather or not exitcode was 0 and return function check { if [ $1 -eq 0 ];then info "code compiled successfully!" else fatal "couldn't compile code!" fi } print_usage() { echo "compile - compiles aic2021 clients" echo echo "Usage: compile [OPTION]..." echo echo " -l, --lang specify the client language to compile" echo " options are:" echo " python client: (py|python|python3|PY|PYTHON|PYTHON3)" echo " c client: (c|cpp|C|CPP)" echo " java client: (jar|jar) note that compile from java" echo " source is not currently available" echo " -e, --entry-point codebase entrypoint [jarfile name for java, python" echo " entrypoint for python (usually Controller.py),leave empty" echo " for cpplient]" echo " -o, --output-path where to save the resulting executable file" echo " if left empty would save at \$PWD/binary" echo echo "Example" echo "-------" echo echo "compile --lang py --entry-point Controller.py -o pyclient" echo "compile -l jar --e jclient.jar -o jar-binary" echo "compile -l cpp" } # argument parsing while [[ $# -gt 0 ]]; do case "$1" in -l|--lang) shift declare -r LANG="$1" shift ;; -o|--output-path) shift BIN_PATH="$1" shift ;; -e|--entry-point) shift declare -r ENTRYPOINT="$1" shift ;; -h|--help) print_usage exit 0 ;; *) echo "ERROR: Unexpected option ${1}" echo print_usage exit 99 ;; esac done # validation if [ -z "$LANG" ]; then fatal "ERROR: You must set the parameter --lang" fi if [ -z "$ENTRYPOINT" ]; then warn "You must set the parameter --entry-point unless you are compiling the cpp client" fi BIN_PATH=`realpath $BIN_PATH` # make an isolated aread mkdir /home/isolated cp -r * /home/isolated cd /home/isolated info "made an isolated area" info "entered the code base" #compile case $LANG in python|py|python3|PYTHON|PY|PYTHON3) info "language detected: python" info "start compiling using pyinstaller" pyinstaller --onefile $ENTRYPOINT >>$LOG_PATH 2>&1 check $? mv dist/Controller $BIN_PATH ;; cpp|c|C|CPP) info "language detected: C" info "start compiling using CMAKE" mkdir build cd build cmake .. >>$LOG_PATH 2>&1 make >>$LOG_PATH 2>&1 check $? mv client/client $BIN_PATH ;; java|JAVA) fatal "not currently supported!\n use [jar] instead" ;; jar|JAR) info "language detected: jar" info "start compiling using jar-stub" cat /home/.jar-stub $ENTRYPOINT > $BIN_PATH 2>> $LOG_PATH check $? ;; bin|BIN) warn "no compiling needed!" mv `ls | head -n1` $BIN_PATH ;; *) fatal "type unknown!" ;; esac chmod +x $BIN_PATH # clean up rm -rf /home/isolated
true
18a53f5c356b47d52508d22770e09c7a7a8740a8
Shell
mixedpuppy/webextension-scan
/lint.sh
UTF-8
139
2.90625
3
[]
no_license
#!/bin/sh for FILE in addons/* do if [[ -d $FILE ]]; then echo `basename $FILE` web-ext lint -s addons/`basename $FILE` fi done
true
291c9e3db9ea22631e261709920c39c8d457abfa
Shell
jlxue/jff
/utils/sync-git-repos.sh
UTF-8
810
3.578125
4
[]
no_license
#!/bin/bash # # Resolve the problem: # git clone reposA reposB # git clone reposB reposC # now reposB contains "origin/branch1, origin/branch2, origin/master", # but reposC contains only "origin/master". # # This scripts synchronized origin/$branch to $branch in reposB, # so that reposC can get all these remote branches. # git pull HEAD=`git symbolic-ref HEAD` git show-ref | grep "refs/remotes/origin/" | grep -v "HEAD$" | while read hash ref; do head=${ref##*/} [ -z "$head" ] && continue echo "Process remote branch $ref..." if git show-ref --verify --quiet -- refs/heads/$head; then [ "$HEAD" != refs/heads/$head ] && git push . $ref:refs/heads/$head else git branch $head $ref fi echo done
true
92bf4bc0d297d08f56a56cf352766b4fc83a1bae
Shell
complexbits/gftptest
/scripts/teragrid_info_test
UTF-8
3,058
4.0625
4
[]
no_license
#!/bin/bash # Script to test available TeraGrid resources # and gather info about them. ################################################ THISSCRIPT=`basename $0` # TeraGrid Host and Login list ################# TGRID_HLIST="./teragrid_hostlist" # Contains HOSTLIST and REMOVED_HOSTS . $TGRID_HLIST # List of Configuration Files ################### FILELIST=" ~/.globus ~/.bashrc ~/.emacs " # FUNCTIONS ##################################### usage_msg(){ echo "Usage: $THISSCRIPT <options>" echo " " echo "Options include:" echo " " echo " help Displays this message. This message is also displayed" echo " if $THISSCRIPT is run with no options specified." echo " " echo " hostnames Returns result of hostname command for each host." echo " Useful for testing to see which hostnames are responding." echo " " echo " sync Syncs gftptest project files to each host." echo " " echo " versions Locates tools and their versions on each host" echo " " echo " proxyinit Initializes proxies across teragrid hosts" echo " " echo " speedtest Attempts to test speed between hosts using iperf, globus-url-copy, ping, or whatever's available." echo " " } sync_files(){ for i in $HOSTLIST; do HOSTONLY=`echo $i | cut -d@ -f2` printf "syncing to $HOSTONLY..." psync up ~/gftptest $i:~/gftptest --exclude binfiles --delete 2>&1 > /dev/null printf "done.\n\n" done } get_hostnames(){ for i in $HOSTLIST; do ssh -XY $i "hostname" done } get_versions(){ for i in $HOSTLIST; do HOSTONLY=`echo $i | cut -d@ -f2` echo "$HOSTONLY:" ssh -XY $i "which globus-version; globus-version" ssh -XY $i "which iperf; /usr/bin/iperf --version" echo " " done } initialize_proxies(){ for i in $HOSTLIST; do HOSTONLY=`echo $i | cut -d@ -f2` echo "$HOSTONLY:" ssh -XY $i "grid-proxy-init" echo " " done } test_transfer_speed(){ for i in $HOSTLIST; do HOSTONLY_i=`echo $i | cut -d@ -f2` echo "$HOSTONLY_i:" for j in $HOSTLIST; do HOSTONLY_j=`echo $j | cut -d@ -f2` # ssh -XY $i "globus-url-copy -vb -p 5 -len 100000 gsiftp://$HOSTONLY_i/dev/zero gsiftp://$HOSTONLY_j/dev/null" # ssh -XY $i "iperf -c $HOSTONLY_j" printf "Pinging $HOSTONLY_j:\n" PINGTEST=`ssh -XY $i "ping -c 4 $HOSTONLY_j | tail -1"` printf "$PINGTEST\n\n" done done } update_config(){ for i in $HOSTLIST; do HOSTONLY=`echo $i | cut -d@ -f2` echo "$HOSTONLY:" echo "#!/bin/bash" > update_files for j in $FILELIST; do echo "scp -r $j $i:~/" >> update_files done echo "exit 0" >> update_files chmod u+x update_files update_files rm -rf update_files echo " " done } ################################################## case $1 in hostnames) get_hostnames;; versions) get_versions;; speedtest) test_transfer_speed;; sync) sync_files;; update) update_config;; proxyinit) initialize_proxies;; help) usage_msg;; *) usage_msg;; esac exit 0
true
8c615bcd376446882aa294708cee18b1b3453948
Shell
CBautistaDev/bash_starter
/random_password.sh
UTF-8
673
3.140625
3
[]
no_license
#!/bin/bash #this script genereate random password #a Random number as a password PASSWORD="${RANDOM}" echo "${PASSWORD}" #three random numbers rogther PASSWORD="${RANDOM}${RANDOM}${RANDOM}" echo "${PASSWORD}" #user the current date/time as the basis for the passwrod PASSWORD=$(date +%s) echo "${PASSWORD}" #User nanoseconds to act as a randomization PASSWORD=$(date +%s%N) echo "${PASSWORD}" # A better password PASSWORD=$(date +%s%N | sha256sum | head -c32) echo ${PASSWORD} #an even btter password S='!@#$%^&' echo "${S}" | fold -w1 | shuf | head -c6 SPECIAL_CHAR=$(echo '!@#$$%5' | fold -w1 | shuf | head -c1) echo ${PASSWORD}${SPECIAL_CHAR}
true
b16a95549f5ae437bf8aa898fb92454650c26d64
Shell
WadeTheEng/WineManual-iOS
/scripts/sign-and-upload.sh
UTF-8
1,322
3.078125
3
[]
no_license
#!/bin/sh if ![[ "$TRAVIS_BRANCH" == "staging" ] || [ "$TRAVIS_BRANCH" == "release" ]]; then echo "Testing on a branch other than staging. No deployment will be done." exit 0 fi PROVISIONING_PROFILE="$HOME/Library/MobileDevice/Provisioning Profiles/$PROFILE_NAME.mobileprovision" OUTPUTDIR="$PWD/build/AdHoc-iphoneos" echo "********************" echo "* Signing *" echo "********************" xcrun -log -sdk iphoneos PackageApplication "$OUTPUTDIR/$APP_NAME.app" -o "$OUTPUTDIR/$APP_NAME.ipa" -sign "$DEVELOPER_NAME" -embed "$PROVISIONING_PROFILE" echo "Uploading to TestFlight" RELEASE_NOTES="Build: $TRAVIS_BUILD_NUMBER\nUploaded: $RELEASE_DATE" zip -r -9 "$OUTPUTDIR/$APP_NAME.app.dSYM.zip" "$OUTPUTDIR/$APP_NAME.app.dSYM" curl http://testflightapp.com/api/builds.json \ -F file="@$OUTPUTDIR/$APP_NAME.ipa" \ -F dsym="@$OUTPUTDIR/$APP_NAME.app.dSYM.zip" \ -F api_token="$TESTFLIGHT_API_TOKEN" \ -F team_token="$TESTFLIGHT_TEAM_TOKEN" \ -F notes="$RELEASE_NOTES" \ -F notify=False -v # Zip dSYM zip -r -9 "$OUTPUTDIR/$APP_NAME.app.dSYM.zip" "$OUTPUTDIR/$APP_NAME.app.dSYM" # Upload dSYM to BugSense curl --form "file=@$OUTPUTDIR/$APP_NAME.app.dSYM.zip" --header "X-BugSense-Auth-Token: $BUGSENSE_ACCOUNT_API_KEY" https://www.bugsense.com/api/v1/project/$BUGSENSE_PROJECT_API_KEY/dsym.json
true
fbc0f7ef573d72903efb86d1a08306c00752ccc3
Shell
mitchryanjusay/dotfiles
/home/.i3/scripts/set-wallpaper.sh
UTF-8
189
2.515625
3
[]
no_license
#!/bin/bash # Will randomize through wallpapers found in # the resource folder WALLPAPERS=$HOME/.i3/res/* feh --bg-fill --randomize $WALLPAPERS notify-send "Wallpaper set successfully"
true
fae6233f47dbff84f632a4a5f4da7698411af8d1
Shell
ustaxcourt/ef-cms
/scripts/dynamo/offboard-judge-user.sh
UTF-8
1,687
3.765625
4
[ "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
#!/bin/bash # Updates the offboarded judge user in the dynamo table based on their userId passed in # Usage # ./offboard-judge-user.sh 68686578-bc34-4aea-bc1d-25e505422843 alpha # Arguments # - $1 - The userId of the judge to offboard # - $2 - The sourceTable to update e.g. alpha ( ! command -v jq > /dev/null ) && echo "jq must be installed on your machine." && exit 1 [ -z "$1" ] && echo "The value to set for the judge userId must be provided as the \$1 argument." && exit 1 [ -z "$2" ] && echo "The value to set for the source table must be provided as the \$2 argument." && exit 1 USER_ID=$1 SOURCE_TABLE=$2 REGION=us-east-1 ./check-env-variables.sh \ "ENV" \ "AWS_SECRET_ACCESS_KEY" \ "AWS_ACCESS_KEY_ID" JUDGE_USER=$(aws dynamodb get-item --region ${REGION} --table-name "efcms-${ENV}-${SOURCE_TABLE}" \ --key '{"pk":{"S":"user|'"${USER_ID}"'"},"sk":{"S":"user|'"${USER_ID}"'"}}' \ | jq -r ".Item" \ ) echo "Retrieved Judge User: ${JUDGE_USER}" if [ -z "${JUDGE_USER}" ]; then echo "Could not find judge user with userId: ${USER_ID} on ${SOURCE_TABLE} table." exit 1 fi UPDATE_OUTPUT=$(aws dynamodb update-item \ --table-name "efcms-${ENV}-${SOURCE_TABLE}" \ --key '{"pk":{"S":"user|'"${USER_ID}"'"},"sk":{"S":"user|'"${USER_ID}"'"}}' \ --update-expression 'SET #role = :role, #section = :section' \ --expression-attribute-names '{"#role": "role", "#section": "section"}' \ --expression-attribute-values '{":role": {"S": "legacyJudge"}, ":section": {"S": "legacyJudgesChambers"}}' \ --return-values UPDATED_NEW \ --region ${REGION} \ ) echo "Updated attributes of user ${USER_ID}: ${UPDATE_OUTPUT} on ${SOURCE_TABLE} table."
true
e75b96ae0c7061870aa0d8bd71eb2b5c90e2f88f
Shell
linsalrob/EdwardsLab
/searchSRA/filter_reads.sh
UTF-8
5,722
4.25
4
[ "MIT" ]
permissive
#!/bin/bash ##################################################################################### # # # Filter reads, written by Rob Edwards, 28/6/21 # # # # Note: This is also available as a snakemake pipeline, but that really craps out # # since we have a very large number of small files to process. Find is a lot # # faster! # # # # To run this, use # # # # # # # # # ##################################################################################### set -euo pipefail results="results" zipfile="results.zip" mapq=3 length=50 verbose=n version=0.1 outdir='./' usage=$(cat <<-EOF $0 Version $version Please provide one of either: -z --zip The path to the file (usually called results.zip) that you downloaded from SearchSRA -r --results The directory with the uncompressed results (e.g. if you have extracted results.zip) -o --outdir The directory to write the results (default: $outdir) -l --length Minimum alignment length for the sequences to keep the alignment. Default: $length -m --mapq Minimum MAPQ (mapping quality) score to keep the alignment. Default $mapq -v --verbose More output -h --help Print this message and exit EOF ) # make sure we have the accessory script! WD=$(dirname $0) if [[ ! -e $WD/merge_counts_abstracts.py ]]; then echo "FATAL: $WD/merge_counts_abstracts.py was not found. Can not merge the data"; exit 2; fi if [[ ! -e $WD/searchSRA_abstracts.tsv.gz ]]; then echo "FATAL: $WD/searchSRA_abstracts.tsv.gz was not found. Can not merge with abstracts"; exit 2; fi echo -e "Welcome to filter_reads.sh version $version.\nPart of the SearchSRA toolkit.\nCopyright Rob Edwards, 2021" echo "Started at "$(date) OPTIONS=r:z:l:m:vho: LONGOPTS=results:,zip:,length:,mapq:,verbose,help,outdir PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@") if [[ ${PIPESTATUS[0]} -ne 0 ]]; then exit 2 fi eval set -- "$PARSED" # now enjoy the options in order and nicely split until we see -- while true; do case "$1" in -h|--help) echo "$usage"; exit 0; ;; -z|--zip) zipfile="$2" shift 2 ;; -m|--mapq) mapq="$2" shift 2 ;; -l|--length) length="$2" shift 2 ;; -r|--results) results="$2" shift 2 ;; -o|--outdir) outdir="$2" mkdir -p $outdir shift 2 ;; -v|--verbose) verbose=y shift ;; --) shift break ;; *) echo "Crap. Some other error" exit 3 ;; esac done if [[ $# -ne 0 ]]; then echo "$0, don't know what $1 is"; exit 2; fi echo -n "Results directory: '$results' " if [[ -d $results ]]; then echo "found"; else echo "NOT FOUND"; echo -n "Zipfile: '$zipfile' " if [[ -e $zipfile ]]; then echo "found. Uncompressing $zipfile to $results"; unzip -d $results $zipfile; else echo -e "NOT FOUND\n"; echo "Sorry, please provide either the results directory if you have already uncompressed it" echo "or the path to the results zip file you downloaded from search SRA" echo "$usage" exit 2; fi fi echo "Filtering $results using length $length mapq: $mapq" # Step 1. Filter the reads # Step 2. Calculate IDX stats FQDIR=$outdir/FILTERED_MAPQ${mapq}_LEN${length} IDXDIR=$outdir/IDXSTATS_MAPQ${mapq}_LEN${length} filterbam=y idxbam=y if [[ -d $FQDIR ]]; then echo "$FQDIR already exists, so not filtering the bam files"; filterbam=n; fi if [[ -d $IDXDIR ]]; then echo "$IDXDIR already exists, so not indexing the bam files"; idxbam=n; fi if [[ $filterbam == y ]] || [[ $idxbam == y ]]; then if [[ $verbose == y ]]; then echo "Parsing and filtering the bam files. Each . is 1000 files"; fi mkdir -p $FQDIR $IDXDIR C=0 for BAMF in $(find $results -name \*bam); do C=$((C+1)) if [[ $verbose == y ]]; then if [[ $((C % 10000)) == 0 ]]; then echo -n " "; elif [[ $((C % 1000)) == 0 ]]; then echo -n "."; fi fi BAMOUT=$(echo $BAMF | sed -s 's#^.*/##'); SAMP=$(echo $BAMOUT | sed -e 's/.bam//'); if [[ $filterbam == y ]]; then samtools view -hq $mapq $BAMF | awk -v l=$length 'length($10) > l || $1 ~ /^@/' | samtools view -bS -o $FQDIR/$BAMOUT samtools index $FQDIR/$BAMOUT; fi if [[ $idxbam == y ]]; then samtools idxstats $FQDIR/$BAMOUT | awk '$3 != 0' | cut -f 1,3 | sed -e "s|^|$SAMP\t|" > $IDXDIR/$SAMP.tsv fi done; if [[ $verbose == y ]]; then echo; fi fi # Step 3. Combine everything with the python script if [[ verbose == y ]]; then echo "Running the python merge script to create reads_per_sample.Q${mapq}.L${length}.tsv and reads_per_project.Q${mapq}.L${length}.tsv"; fi python3 $WD/merge_counts_abstracts.py -d $IDXDIR -a $WD/searchSRA_abstracts.tsv.gz -r $outdir/reads_per_sample.Q${mapq}.L${length}.tsv -p $outdir/reads_per_project.Q${mapq}.L${length}.tsv
true
e54e71419189957e7e7e8e292a54070c68ca13be
Shell
kmac94/cvrProject
/SRAexplorer/SRAexplorer_weekly.sh
UTF-8
446
2.8125
3
[]
no_license
#!/bin/sh #script to run weekly on webserver using cron current_time=$(date "+Y.%m.%d") echo "Current Time : $current_time" perl sra_weekly.pl > newestdata.txt Rscript dataCuration.R echo 'curating data' perl fetchTaxID.pl > taxonData.txt echo 'accessing taxonomy database' Rscript fetchGeocode.R Rscript mergeData.R cp ShinyData.txt /srv/shiny-server/SRAexplorer/. newfile="ShinyData".$current_time.".txt" mv ShinyData.txt $newfile
true
98047aadfab157c3a20754a572dd94f2c8ef19db
Shell
w0ng/bin
/google-drive-icon-inverter
UTF-8
697
3.6875
4
[]
no_license
#!/bin/bash # # Invert Google Drive's OSX notification icon colours # to make it visible in Yosemite's dark menu bar resource_dir="$HOME/Applications/Google Drive.app/Contents/Resources" if [[ ! -d "${resource_dir}" ]]; then echo "Google Drive not found in ${resource_dir}" exit 1 fi cd "${resource_dir}" for filename in ./*-inverse*.png; do img="${filename/-inverse/}" img_tmp="${img}.tmp" img_inverse="${filename}" if [[ -f "${img}" && -f "${img_inverse}" ]]; then mv "${img}" "${img_tmp}" mv "${img_inverse}" "${img}" mv "${img_tmp}" "${img_inverse}" fi done echo "Inverse icon images swapped successfully. Restart Google Drive." exit 0
true
acb8571f699de66f2ea08ae39627ef2b04616b91
Shell
mc-b/lernmaas
/services/k8sjoin.sh
UTF-8
1,459
3.859375
4
[ "Apache-2.0" ]
permissive
#!/bin/bash # # Kubernetes Join Worker # SERVER_IP=$(sudo cat /var/lib/cloud/instance/datasource | cut -d: -f3 | cut -d/ -f3) MASTER=$(hostname | cut -d- -f 3,4) # Master vorhanden? if [ "${SERVER_IP}" != "" ] && [ "${MASTER}" != "" ] then # Master statt Worker Node mounten sudo umount /home/ubuntu/data sudo mount -t nfs ${SERVER_IP}:/data/storage/${MASTER} /home/ubuntu/data/ sudo sed -i -e "s/$(hostname)/${MASTER}/g" /etc/fstab # Password und ssh-key wie Master sudo chpasswd <<<ubuntu:$(cat /home/ubuntu/data/.ssh/passwd) cat /home/ubuntu/data/.ssh/id_rsa.pub >>/home/ubuntu/.ssh/authorized_keys # loop bis Master bereit, Timeout zwei Minuten for i in {1..60} do if [ -f /home/ubuntu/data/join-${MASTER}.sh ] then sudo bash -x /home/ubuntu/data/join-${MASTER}.sh break fi sleep 2 done fi ## Hinweis wie joinen, falls nicht geklappt if [ -f /etc/kubernetes/kubelet.conf ] then cat <<%EOF% | sudo tee README.md ### Kubernetes Worker Node Worker Node von Kubernetes ${MASTER} Master %EOF% else cat <<%EOF% | sudo tee README.md ### Kubernetes Worker Node Um die Worker Node mit dem Master zu verbinden, ist auf dem Master folgender Befehl zu starten: sudo kubeadm token create --print-join-command Dieser gibt den Befehl aus, der auf jedem Worker Node zu starten ist. %EOF% fi bash -x helper/intro
true
baba28b2535f2ac5d207752961ce2ec534c9bf34
Shell
liusongWtu/.sys.config
/settings/my.sh
UTF-8
1,186
2.546875
3
[]
no_license
alias cls='clear' alias ll='ls -l' alias la='ls -a' alias vi='vim' alias javac="javac -J-Dfile.encoding=utf8" alias grep="grep --color=auto" alias -s html=mate # 在命令行直接输入后缀为 html 的文件名,会在 TextMate 中打开 alias -s rb=mate # 在命令行直接输入 ruby 文件,会在 TextMate 中打开 alias -s py=vi # 在命令行直接输入 python 文件,会用 vim 中打开,以下类似 alias -s js=vi alias -s c=vi alias -s java=vi alias -s txt=vi alias -s gz='tar -xzvf' alias -s tgz='tar -xzvf' alias -s zip='unzip' alias -s bz2='tar -xjvf' alias ..="cd .." alias ..2="cd ../.." alias ..3="cd ../../.." alias ..4="cd ../../../.." alias ..5="cd ../../../../.." # dirs alias cdwxgame_go='cd /Users/song/Server/go/wxgame_go' alias cdcjclient='cd /Users/song//work/xiaozi/jdcj/battle' alias cdcjdocuments='cd /Users/song/work/xiaozi/jdcj/jdcj/配置表' alias cdcjfight='cd /Users/song/work/xiaozi/jdcj/wxgame_go' alias cdcjmicro='cd /Users/song/work/xiaozi/jdcj/game_micro' # tool alias airportdpid=`ps aux | grep -v grep | grep /usr/libexec/airportd | awk '{print $2}'` alias kill9='sudo kill -9' #https://zhuanlan.zhihu.com/p/19556676
true
a62aa72d2ab8183e7bcd3a9e7148c4e73d6e04a0
Shell
ferferga/jellyfin-metapackages
/collect-server.azure.sh
UTF-8
26,399
4.1875
4
[]
no_license
#!/usr/bin/env bash # Jellyfin Azure builds collection script # Parses the artifacts uploaded from an Azure build and puts them into place, as well as building the various metapackages, metaarchives, and Docker metaimages. logfile="/var/log/build/collect-server.log" exec 2>>${logfile} #exec 1>>${logfile} #exec 3>&1 # Ensure we're running as root (i.e. sudo $0) if [[ $( whoami ) != 'root' ]]; then echo "Script must be run as root" fi ( # Acquire an exclusive lock so multiple simultaneous builds do not override each other flock -x 300 time_start=$( date +%s ) # Static variables repo_dir="/srv/jellyfin" metapackages_dir="${repo_dir}/projects/server/jellyfin-metapackages" plugins_dir="${repo_dir}/projects/plugin/" linux_static_arches=( "amd64" "amd64-musl" "arm64" "armhf" ) docker_arches=( "amd64" "arm64" "armhf" ) releases_debian=( "stretch" "buster" "bullseye" ) releases_ubuntu=( "xenial" "bionic" "focal" "groovy" ) echo "**********" 1>&2 date 1>&2 echo "**********" 1>&2 set -o xtrace # Get our input arguments echo ${0} ${@} 1>&2 indir="${1}" build_id="${2}" if [[ "${3}" =~ [Uu]nstable ]]; then is_unstable='unstable' else is_unstable='' fi # Abort if we're missing arguments if [[ -z ${indir} || -z ${build_id} ]]; then exit 1 fi # These rely on the naming format jellyin-{type}[-_]{ver}[-_]junk examplefile="$( find ${indir}/${build_id} -type f \( -name "jellyfin-*.deb" -o -name "jellyfin_*.exe" \) | head -1 )" servertype="$( awk -F '[_-]' '{ print $2 }' <<<"${examplefile}" )" version="$( awk -F'[_-]' '{ print $3 }' <<<"${examplefile}" )" if [[ -z "${version}" ]]; then echo "Found no example package for this version, bailing out!" exit 1 fi if [[ -z ${is_unstable} && ${version} =~ "~rc" ]]; then echo "This is an RC" is_rc="rc" else is_rc="" fi # Ensure Metapackages repo is cloned and up-to-date echo "Ensuring metapackages repo is up to date" pushd ${repo_dir} 1>&2 ./build.py --clone-only jellyfin-metapackages 1>&2 popd 1>&2 pushd ${metapackages_dir} 1>&2 git checkout master 1>&2 git fetch --all 1>&2 git stash 1>&2 git pull --rebase 1>&2 popd 1>&2 skip_docker="" # Debian collection function do_deb() { if [[ -n ${is_rc} ]]; then return fi typename="${1}" platform="${typename%.*}" case ${platform} in debian) releases=( ${releases_debian[@]} ) ;; ubuntu) releases=( ${releases_ubuntu[@]} ) ;; esac repodir="/srv/repository/${platform}" if [[ -z ${is_unstable} ]]; then component="-C main" else component="-C unstable" fi # Reprepro repository for release in ${releases[@]}; do echo "Importing files into ${release}" reprepro -b ${repodir} --export=never --keepunreferencedfiles \ ${component} \ includedeb \ ${release} \ ${indir}/${build_id}/${typename}/*.deb done echo "Cleaning and exporting repository" reprepro -b ${repodir} deleteunreferenced reprepro -b ${repodir} export chown -R root:adm ${repodir} chmod -R g+w ${repodir} } # Static files collection function do_files() { typename="${1}" platform="${typename%.*}" # Strip off the architecture if [[ ${platform} == 'windows-installer' ]]; then platform="windows" servertype="installer" fi filedir="/srv/repository/releases/server/${platform}" if [[ -n ${is_unstable} ]]; then releasedir="versions/unstable/${servertype}/${version}" linkdir="unstable" elif [[ -n ${is_rc} ]]; then releasedir="versions/stable-rc/${servertype}/${version}" linkdir="stable-rc" else releasedir="versions/stable/${servertype}/${version}" linkdir="stable" fi # Static files echo "Creating release directory" mkdir -p ${filedir}/${releasedir} mkdir -p ${filedir}/${linkdir} if [[ -L ${filedir}/${linkdir}/${servertype} ]]; then rm -f ${filedir}/${linkdir}/${servertype} fi ln -s ../${releasedir} ${filedir}/${linkdir}/${servertype} echo "Copying files" mv ${indir}/${build_id}/${typename}/* ${filedir}/${releasedir}/ echo "Creating sha256sums" for file in ${filedir}/${releasedir}/*; do if [[ ${file} =~ ".sha256sum" ]]; then continue fi sha256sum ${file} | sed 's, .*/, ,' > ${file}.sha256sum done echo "Cleaning repository" chown -R root:adm ${filedir} chmod -R g+w ${filedir} } # Portable Linux (multi-arch) combination function # Static due to the requirement to do 4 architectures do_combine_portable_linux() { platform="linux" case ${servertype} in server) partnertype="web" filedir="/srv/repository/releases/server/${platform}" ;; web) partnertype="server" filedir="/srv/repository/releases/server/${platform}" ;; esac filetype="tar.gz" if [[ -n ${is_unstable} ]]; then stability="unstable" pkgend="-unstable" elif [[ -n ${is_rc} ]]; then stability="stable-rc" pkgend="" else stability="stable" pkgend="" fi releasedir="versions/${stability}/${servertype}" partnerreleasedir="versions/${stability}/${partnertype}" linkdir="${stability}/combined" # We must work through all 4 types in linux_static_arches[@] for arch in ${linux_static_arches[@]}; do case ${servertype} in server) server_archive="$( find ${filedir}/${releasedir}/${version} -type f -name "jellyfin-${servertype}*${arch}.${filetype}" | head -1 )" if [[ -z ${is_unstable} ]]; then web_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*${version}*.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )" else web_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )" fi if [[ ! -f ${web_archive} ]]; then continue fi ;; web) server_archive="$( find ${filedir}/${partnerreleasedir}/${version} -type f -name "jellyfin-${servertype}*.${filetype}" | head -1 )" if [[ -z ${is_unstable} ]]; then web_archive="$( find ${filedir}/${releasedir} -type f -name "*${version}*${arch}.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )" else web_archive="$( find ${filedir}/${releasedir} -type f -name "*${arch}.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )" fi if [[ ! -f ${server_archive} ]]; then continue fi ;; esac tempdir=$( mktemp -d ) echo "Unarchiving server archive" tar -xzf ${server_archive} -C ${tempdir}/ echo "Correcting root directory naming" pushd ${tempdir} 1>&2 server_dir="$( find . -maxdepth 1 -type d -name "jellyfin-server_*" | head -1 )" mv ${server_dir} ./jellyfin_${version} popd 1>&2 echo "Unarchiving web archive" tar -xzf ${web_archive} -C ${tempdir}/jellyfin_${version}/ echo "Correcting web directory naming" pushd ${tempdir}/jellyfin_${version}/ 1>&2 web_dir="$( find . -maxdepth 1 -type d -name "jellyfin-web_*" | head -1 )" mv ${web_dir} jellyfin-web popd 1>&2 echo "Creating combined tar archive" pushd ${tempdir} 1>&2 chown -R root:root ./ tar -czf ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}_${arch}.tar.gz ./ echo "Creating sha256sums" sha256sum ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}_${arch}.tar.gz | sed 's, .*/, ,' > ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}_${arch}.tar.gz.sha256sum popd 1>&2 rm -rf ${tempdir} done } # Portable archive combination function do_combine_portable() { typename="${1}" platform="${typename%.*}" case ${servertype} in server) partnertype="web" filedir="/srv/repository/releases/server/${platform}" ;; web) partnertype="server" filedir="/srv/repository/releases/server/${platform}" ;; esac if [[ ${platform} == "windows" ]]; then filetype="zip" else filetype="tar.gz" fi if [[ -n ${is_unstable} ]]; then stability="unstable" pkgend="-unstable" elif [[ -n ${is_rc} ]]; then stability="stable-rc" pkgend="" else stability="stable" pkgend="" fi releasedir="versions/${stability}/${servertype}" partnerreleasedir="versions/${stability}/${partnertype}" linkdir="${stability}/combined" our_archive="$( find ${filedir}/${releasedir}/${version} -type f -name "jellyfin-${servertype}*.${filetype}" | head -1 )" if [[ -z ${is_unstable} ]]; then partner_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*${version}*.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )" else partner_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )" fi if [[ ! -f ${partner_archive} ]]; then return fi tempdir=$( mktemp -d ) case ${servertype} in server) server_archive="${our_archive}" web_archive="${partner_archive}" ;; web) server_archive="${partner_archive}" web_archive="${our_archive}" ;; esac echo "Unarchiving server archive" if [[ ${filetype} == "zip" ]]; then unzip ${server_archive} -d ${tempdir}/ &>/dev/null else tar -xzf ${server_archive} -C ${tempdir}/ fi echo "Correcting root directory naming" pushd ${tempdir} 1>&2 server_dir="$( find . -maxdepth 1 -type d -name "jellyfin-server_*" | head -1 )" mv ${server_dir} ./jellyfin_${version} popd 1>&2 echo "Unarchiving web archive" if [[ ${filetype} == "zip" ]]; then unzip ${web_archive} -d ${tempdir}/jellyfin_${version}/ &>/dev/null else tar -xzf ${web_archive} -C ${tempdir}/jellyfin_${version}/ fi echo "Correcting web directory naming" pushd ${tempdir}/jellyfin_${version}/ 1>&2 web_dir="$( find . -maxdepth 1 -type d -name "jellyfin-web_*" | head -1 )" mv ${web_dir} jellyfin-web popd 1>&2 pushd ${tempdir} 1>&2 mkdir -p ${filedir}/versions/${stability}/combined/${version} if [[ ${filetype} == "zip" ]]; then echo "Creating combined zip archive" chown -R root:root ./ zip -r ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}.zip ./* &>/dev/null echo "Creating sha256sums" sha256sum ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}.zip | sed 's, .*/, ,' > ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}.zip.sha256sum else echo "Creating combined tar archive" chown -R root:root ./ tar -czf ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}.tar.gz ./ echo "Creating sha256sums" sha256sum ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}.tar.gz | sed 's, .*/, ,' > ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}.tar.gz.sha256sum fi popd 1>&2 echo "Creating links" if [[ -L ${filedir}/${linkdir} ]]; then rm -f ${filedir}/${linkdir} fi ln -s ../versions/${stability}/combined/${version} ${filedir}/${linkdir} echo "Cleaning up" rm -rf ${tempdir} } # Debian Metapackage function do_deb_meta() { typename="${1}" platform="${typename%.*}" pushd ${metapackages_dir} 1>&2 case ${platform} in debian) codename="buster" ;; ubuntu) codename="bionic" ;; esac filedir="/srv/repository/releases/server/${platform}" if [[ -n ${is_unstable} ]]; then releasedir="versions/unstable/meta/${version}" linkdir="unstable" versend="-unstable" elif [[ -n ${is_rc} ]]; then releasedir="versions/stable-rc/meta/${version}" linkdir="stable-rc" versend="" else releasedir="versions/stable/meta/${version}" linkdir="stable" versend="-1" fi if [[ -z ${is_unstable} && -n ${is_rc} ]]; then # Check if we're the first one done and abandon this if so (let the last build trigger the metapackage) if [[ $( reprepro -b /srv/repository/${platform} -C main list ${codename} jellyfin-web | awk '{ print $NF }' | sort | uniq | grep -F "${version}" | wc -l ) -lt 1 && $( reprepro -b /srv/repository/${platform} -C main list ${codename} jellyfin-server | awk '{ print $NF }' | sort | uniq | grep -F "${version}" | wc -l ) -lt 1 ]]; then return fi # For stable releases, fix our dependency to the version server_checkstring="(>=${version}-0)" web_checkstring="(>=${version}-0)" sed -i "s/Depends: jellyfin-server, jellyfin-web/Depends: jellyfin-server ${server_checkstring}, jellyfin-web ${web_checkstring}/g" jellyfin.debian fi # Check if there's already a metapackage (e.g. this is the second or later arch for this platform) if [[ -n ${is_rc} ]]; then if [[ $( reprepro -b /srv/repository/${platform} -C main list ${codename} jellyfin | awk '{ print $NF }' | sort | uniq | grep -F "${version}" | wc -l ) -gt 0 ]]; then return fi fi sed -i "s/X.Y.Z/${version}${versend}/g" jellyfin.debian echo "Building metapackage" equivs-build jellyfin.debian 1>&2 case ${platform} in debian) release=( ${releases_debian[@]} ) ;; ubuntu) release=( ${releases_ubuntu[@]} ) ;; esac repodir="/srv/repository/${platform}" if [[ -z ${is_rc} ]]; then if [[ -z ${is_unstable} ]]; then component="-C main" else component="-C unstable" fi # Reprepro repository for release in ${releases[@]}; do echo "Importing files into ${release}" reprepro -b ${repodir} --export=never --keepunreferencedfiles \ ${component} \ includedeb \ ${release} \ ./*.deb done echo "Cleaning and exporting repository" reprepro -b ${repodir} deleteunreferenced reprepro -b ${repodir} export chown -R root:adm ${repodir} chmod -R g+w ${repodir} fi # Static files echo "Creating release directory" mkdir -p ${filedir}/${releasedir} mkdir -p ${filedir}/${linkdir} if [[ -L ${filedir}/${linkdir}/meta ]]; then rm -f ${filedir}/${linkdir}/meta fi ln -s ../${releasedir} ${filedir}/${linkdir}/meta echo "Copying files" mv ./*.deb ${filedir}/${releasedir}/ echo "Creating sha256sums" for file in ${filedir}/${releasedir}/*.deb; do if [[ ${file} =~ "*.sha256sum" ]]; then continue fi sha256sum ${file} | sed 's, .*/, ,' > ${file}.sha256sum done echo "Cleaning repository" chown -R root:adm ${filedir} chmod -R g+w ${filedir} # Clean up our changes git checkout jellyfin.debian popd 1>&2 } # Docker Metaimage function do_docker_meta() { pushd ${metapackages_dir} 1>&2 if [[ -n ${is_rc} ]]; then # We have to fix the tag version name because what we have is wrong oversion="${version}" version="$( sed 's/~rc/-rc/g' <<<"${version}" )" fi if [[ -n ${is_unstable} ]]; then group_tag="unstable" release_tag="unstable" cversion="${version}-unstable" elif [[ -n ${is_rc} ]]; then group_tag="stable-rc" release_tag="${version}" cversion="${version}" else group_tag="latest" release_tag="${version}" cversion="${version}" fi # During a real release, we must check that both builder images are up; if one isn't, we're the first one done (or it failed), so return if [[ -z ${is_unstable} ]]; then server_ok="" web_ok="" for arch in ${docker_arches[@]}; do curl --silent -f -lSL https://index.docker.io/v1/repositories/jellyfin/jellyfin-server/tags/${version}-${arch} >/dev/null && server_ok="${server_ok}y" done curl --silent -f -lSL https://index.docker.io/v1/repositories/jellyfin/jellyfin-web/tags/${version} >/dev/null && web_ok="y" if [[ ${server_ok} != "yyy" || ${web_ok} != "y" ]]; then return fi fi # We're in a stable or rc build, and this image already exists, so abort if curl --silent -f -lSL https://index.docker.io/v1/repositories/jellyfin/jellyfin/tags/${version} >/dev/null; then return fi # Enable Docker experimental features (manifests) export DOCKER_CLI_EXPERIMENTAL=enabled echo "Building combined Docker images" docker_image="jellyfin/jellyfin" docker login 1>&2 # Prepare the QEMU image docker run --rm --privileged multiarch/qemu-user-static:register --reset 1>&2 # Prepare log dir mkdir -p /var/log/build/docker-combined for arch in ${docker_arches[@]}; do echo "Building Docker image for ${arch}" # Build the image docker build --no-cache --pull -f Dockerfile.${arch} -t "${docker_image}":"${cversion}-${arch}" --build-arg TARGET_RELEASE=${release_tag} . &>/var/log/build/docker-combined/${version}.${arch}.log || return & done # All images build in parallel in the background; wait for them to finish # This minimizes the amount of time that an alternative Docker image could be uploaded, # thus resulting in inconsistencies with these images. By doing these in parallel they # grap upstream as soon as possible then can take as long as they need. echo -n "Waiting for docker builds..." while [[ $( ps aux | grep '[d]ocker build' | wc -l ) -gt 0 ]]; do sleep 15 echo -n "." done echo " done." # Push the images for arch in ${docker_arches[@]}; do echo "Pushing Docker image for ${arch}" docker push "${docker_image}":"${cversion}-${arch}" 1>&2 done # Create the manifests echo "Creating Docker image manifests" for arch in ${docker_arches[@]}; do image_list_cversion="${image_list_cversion} ${docker_image}:${cversion}-${arch}" image_list_grouptag="${image_list_grouptag} ${docker_image}:${cversion}-${arch}" done docker manifest create --amend "${docker_image}":"${cversion}" ${image_list_cversion} 1>&2 docker manifest create --amend "${docker_image}":"${group_tag}" ${image_list_grouptag} 1>&2 # Push the manifests echo "Pushing Docker image manifests" docker manifest push --purge "${docker_image}":"${cversion}" 1>&2 docker manifest push --purge "${docker_image}":"${group_tag}" 1>&2 # Remove images for arch in ${docker_arches[@]}; do echo "Removing pushed docker image for ${arch}" docker image rm "${docker_image}":"${cversion}-${arch}" 1>&2 done docker image prune --force 1>&2 find /var/log/build/docker-combined -mtime +7 -exec rm {} \; popd 1>&2 if [[ -n ${is_rc} ]]; then # Restore the original version variable version="${oversion}" fi } cleanup_unstable() { typename="${1}" platform="${typename%.*}" if [[ -z ${is_unstable} ]]; then return fi filedir="/srv/repository/releases/server/${platform}/versions/unstable" find ${filedir} -mindepth 2 -maxdepth 2 -type d -mtime +2 -exec rm -r {} \; } # For web, which does not build every platform, make copies so we parse sanely later if [[ ${servertype} == 'web' ]]; then if [[ ! -d ${indir}/${build_id}/ubuntu ]]; then cp -a ${indir}/${build_id}/debian ${indir}/${build_id}/ubuntu rmdir ${indir}/${build_id}/ubuntu/portable fi if [[ ! -d ${indir}/${build_id}/macos ]]; then cp -a ${indir}/${build_id}/portable ${indir}/${build_id}/macos rmdir ${indir}/${build_id}/macos/portable fi if [[ ! -d ${indir}/${build_id}/linux ]]; then cp -a ${indir}/${build_id}/portable ${indir}/${build_id}/linux rmdir ${indir}/${build_id}/linux/portable fi if [[ ! -d ${indir}/${build_id}/windows ]]; then cp -a ${indir}/${build_id}/portable ${indir}/${build_id}/windows rmdir ${indir}/${build_id}/windows/portable # Convert the .tar.gz archive to a .zip archive for consistency for filename in $( find ${indir}/${build_id}/windows/ -name "*.tar.gz" ); do archive_tempdir=$( mktemp -d ) fbasename="$( basename ${filename} .tar.gz )" pushd ${archive_tempdir} 1>&2 tar -xzf ${filename} -C ./ chown -R root:root ./ zip -r ${indir}/${build_id}/windows/${fbasename}.zip ./* &>/dev/null popd 1>&2 rm -r ${archive_tempdir} rm ${filename} done fi fi # Main loop for directory in ${indir}/${build_id}/*; do typename="$( awk -F'/' '{ print $NF }' <<<"${directory}" )" echo "> Processing $typename" case ${typename} in debian*) do_deb ${typename} do_deb_meta ${typename} do_files ${typename} cleanup_unstable ${typename} ;; ubuntu*) do_deb ${typename} do_deb_meta ${typename} do_files ${typename} cleanup_unstable ${typename} ;; fedora*) do_files ${typename} cleanup_unstable ${typename} ;; centos*) do_files ${typename} cleanup_unstable ${typename} ;; portable) do_files ${typename} do_combine_portable ${typename} cleanup_unstable ${typename} ;; linux*) do_files ${typename} do_combine_portable_linux cleanup_unstable ${typename} ;; windows-installer*) # Modify the version info of the package if unstable if [[ -n ${is_unstable} ]]; then echo "Renaming Windows installer file to unstable version name" pushd ${indir}/${build_id}/${typename} 1>&2 # Correct the version mmv "jellyfin_*_windows-x64.exe" "jellyfin_${build_id}-unstable_x64.exe" 1>&2 # Redo the version version="${build_id}" popd 1>&2 fi do_files ${typename} cleanup_unstable windows # Manual set to avoid override # Skip Docker, since this is not a real build skip_docker="true" ;; windows*) # Trigger the installer build; this is done here due to convolutions doing it in the CI itself #if [[ -n ${is_unstable} ]]; then # echo "Triggering pipeline build for Windows Installer (unstable)" # #az pipelines build queue --organization https://dev.azure.com/jellyfin-project --project jellyfin --definition-id 30 --branch master --variables Trigger="Unstable" 1>&2 #else # echo "Triggering pipeline build for Windows Installer (stable v${version})" # #az pipelines build queue --organization https://dev.azure.com/jellyfin-project --project jellyfin --definition-id 30 --branch master --variables Trigger="Stable" TagName="v${version}" 1>&2 #fi do_files ${typename} do_combine_portable ${typename} cleanup_unstable ${typename} ;; macos*) do_files ${typename} do_combine_portable ${typename} cleanup_unstable ${typename} ;; esac done if [[ -z ${skip_docker} ]]; then echo "> Processing docker" do_docker_meta fi if [[ -f ${indir}/${build_id}/openapi.json ]]; then echo "> Processing OpenAPI spec" api_root="/srv/repository/releases/openapi" if [[ -z ${is_unstable} ]]; then api_dir="${api_root}/stable" api_version="${version}" link_name="jellyfin-openapi-stable" else api_dir="${api_root}/unstable" api_version="${build_id}" link_name="jellyfin-openapi-unstable" fi mkdir -p ${api_dir} if ! diff -q ${indir}/${build_id}/openapi.json ${api_root}/${link_name}.json &>/dev/null; then # Only replace the OpenAPI spec if they differ mv ${indir}/${build_id}/openapi.json ${api_dir}/jellyfin-openapi-${api_version}.json if [[ -L ${api_root}/${link_name}.json ]]; then rm -f ${api_root}/${link_name}_previous.json mv ${api_root}/${link_name}.json ${api_root}/${link_name}_previous.json fi ln -s ${api_dir}/jellyfin-openapi-${api_version}.json ${api_root}/${link_name}.json fi fi # Cleanup rm -r ${indir}/${build_id} # Run mirrorbits refresh mirrorbits refresh # Build unstable plugins if [[ -n ${is_unstable} ]]; then pushd ${repo_dir} export JELLYFIN_REPO="/srv/repository/releases/plugin/manifest-unstable.json" for plugin in ${plugins_dir}/jellyfin-plugin-*; do /srv/jellyfin/build-plugin.sh ${plugin} unstable chown -R build:adm ${plugin} done popd fi time_end=$( date +%s ) time_total=$( echo "${time_end} - ${time_start}" | bc ) echo "Finished at $( date ) in ${time_total} seconds" 1>&1 echo "Finished at $( date ) in ${time_total} seconds" 1>&2 ) 300>/var/log/collect-server.lock rm /var/log/collect-server.lock exit 0
true
98abdf958628ad84b8c161d6ecd0c4e4d7e3e336
Shell
jimador/narrative
/reputation/scripts/updateDB
UTF-8
634
3.296875
3
[ "MIT" ]
permissive
#!/usr/bin/env bash scriptDir=$(cd "$(dirname "$0")"; pwd) pushd $scriptDir/.. . $scriptDir/setEnv res="$( which mvn )" if [ -z "$res" ]; then echo Error - you must have Maven on your path exit -1 fi echo -e url=$(askForValue 'MySQL URL to update' 'jdbc:mysql://127.0.0.1:3306') pass=$(askForValue 'reputation_user password' 'password' 'true') echo -e args="-Dliquibase.username=reputation_user \ -Dliquibase.changelogfile=db/changelog/db.changelog-master.xml -Dliquibase.contexts=install,update" mvn process-resources liquibase:update@update -Dliquibase.url="${url}" -Dliquibase.password="${pass}" ${args} popd
true
1e5bd3d9ce7915012761245710b03cbbb14bed29
Shell
gbb/fast_map_intersection
/fast_map_intersection.sh
UTF-8
5,224
3.625
4
[]
no_license
#!/bin/bash # Fast parallel map intersection generator. # Written by Graeme Bell, Norwegian Forest and Landscape Institute, Sep 2014. # Postgresql License (open source). # This script writes lots of queries that form a large intersection, and runs them in parallel carefully # It's very useful for intersections on large geometry sets. # IMPORTANT NOTE: It is __extremely__ important to have spatial indices on your source datasets! # Remember to put a spatial index on your final result if you need that. # v1.0.1 ######### Start of options ######### WORK_MEM=200 # set a slightly higher work_mem if you're in a hurry. 200-500 on vroom2 is ok. 100 on DB04. SPLIT=10 # e.g. 1 dataset = 10 pieces, 2 datasets=100 pieces, ... (10-20 is a good number usually). JOBS=8 # number of tasks to run in parallel. Vroom=4/8, db04=8, vroom2=16/32. # Name of destination schema. Change this. RESULT_SCHEMA='public' # Name of table for the final results. Change this. RESULT_TABLE='output_table1' # SQL login command. Change this. # If you're using a username/password, you can use "PGPASSWORD=mypassword psql -h name -U username DBNAME" DB_LOGIN='psql dbname' # ###################### The Tricky Bit ######################## # ----> The 'make_sql' section is where you type your intersection SQL query. <----- # Adjust the 'id' parts if you want, add extra columns, add extra WHERE clauses. # Notes # It may be helpful to put indices/primary key on your gid/id/sl_sdeid/objectid columns. # You MUST leave the $1/$2/$3/$4/$5/$6 variables and the geo-index check in place. # Edit the part between <<EOF / EOF # parameter explanation: $1/$2=$i/$j (split variables) $3=$SPLIT $4=$RESULT_SCHEMA.$RESULT_TABLE $5=${DB_LOGIN} $6=$WORK_MEM # In this example we build all intersections of map1 and map2 and simply track the object ids they came from. function make_sql { perl -pe 's/\n/ /g;' << EOF echo " SET work_mem TO '${6}MB'; CREATE UNLOGGED TABLE ${4}_${1}_${2} AS SELECT a.gid as map1gid, b.gid as map2gid, st_intersection(a.geom,b.geom) AS geom FROM map1 a, map2 b WHERE st_intersects(a.geom, b.geom) AND a.gid%$3=${1} AND b.gid%$3=${2}; " | ${5} EOF echo } ######### End of options ######### # Specify how to generate all the indices on the final results. # You don't need to adjust this line normally but it's here just in case... # You may be using a 'geom' column instead of 'geo'? MAKE_GEOIDX="create index ${RESULT_TABLE}_geoidx on ${RESULT_SCHEMA}.${RESULT_TABLE} using gist(geom);" ######## PROGRAM ######### # Delete any old working files and generate sql commands to do the work. rm -f prep_commands tidy_commands split_commands join_commands index_commands # Delete any result table/sequence with the same target name. Working/temporary tables are deleted in the next section. echo -e "echo \"DROP SEQUENCE IF EXISTS ${RESULT_SCHEMA}.${RESULT_TABLE}_gid;\" | ${DB_LOGIN}" >> prep_commands echo -e "echo \"DROP TABLE IF EXISTS ${RESULT_SCHEMA}.${RESULT_TABLE};\" | ${DB_LOGIN}" >> prep_commands # Create the split/join/tidy command sets. These are all generated together. echo -en "echo \"CREATE SEQUENCE ${RESULT_TABLE}_gid; " >> join_commands echo -en "CREATE TABLE ${RESULT_SCHEMA}.${RESULT_TABLE} AS SELECT nextval('${RESULT_TABLE}_gid') as gid,b.* FROM (SELECT * FROM " >> join_commands for i in `seq 0 $((SPLIT-1))`; do for j in `seq 0 $((SPLIT-1))`; do make_sql "${i}" "${j}" "${SPLIT}" "${RESULT_SCHEMA}.${RESULT_TABLE}" "${DB_LOGIN}" "${WORK_MEM}" >> split_commands echo -e "echo \"DROP TABLE IF EXISTS ${RESULT_SCHEMA}.${RESULT_TABLE}_${i}_${j};\" | ${DB_LOGIN}" >> prep_commands echo -e "echo \"DROP TABLE IF EXISTS ${RESULT_SCHEMA}.${RESULT_TABLE}_${i}_${j};\" | ${DB_LOGIN}" >> tidy_commands echo -en "${RESULT_SCHEMA}.${RESULT_TABLE}_${i}_${j} UNION ALL SELECT * FROM " >> join_commands done done # Commands to close the union command, and analyze/index the new table. echo -en "(select * from ${RESULT_SCHEMA}.${RESULT_TABLE}_0_0 limit 0) as tmp1 ) as b; alter table ${RESULT_SCHEMA}.${RESULT_TABLE} add PRIMARY KEY (gid);\" | ${DB_LOGIN}" >> join_commands echo -e "echo \"$MAKE_GEOIDX\" | ${DB_LOGIN}" >> index_commands echo -e "analyze ${RESULT_SCHEMA}.${RESULT_TABLE} | ${DB_LOGIN};" >> tidy_commands ## Do the work # Prepare DB for new result cat prep_commands | parallel -j $JOBS --progress # Make partial results tables cat split_commands | parallel -j $JOBS --progress # Build final result table cat join_commands | parallel -j $JOBS --progress # Tidy up partial results in the database. cat tidy_commands | parallel -j $JOBS --progress # Generate index(es) on the result table cat index_commands | parallel -j $JOBS --progress # Clean up command files rm prep_commands tidy_commands split_commands join_commands index_commands ##### FINAL NOTES ##### # NOTE! Do not use a bounding box square to find intersection. # This actually slows things down. The spatial index is already like a magic black box # which gets us all the intersecting polygons instantly. # Using a bounding box actually prevents this technique working with non-geo tables.
true
fb0dbf827cf9009c0451ef2024b1a7ac2ff58651
Shell
osintlxc/ansible-vpn
/roles/letsencrypt/files/hook.sh
UTF-8
440
3
3
[]
no_license
#!/usr/bin/env bash case "$1" in deploy_challenge) ;; clean_challenge) ;; deploy_cert) systemctl reload apache2 if [ -d /etc/.git ]; then cd "$(dirname "$3")" git add . git commit -m "letsencrypt: refreshed certificate for $2" . fi ;; unchanged_cert) ;; *) echo "Unknown hook $1" exit 1 ;; esac exit 0
true
b4f7b42924c305670a724916da9fa036fc8936e1
Shell
mafia-007/arch-PKGBUILDs
/community/neko/PKGBUILD
UTF-8
1,156
2.640625
3
[]
no_license
# Maintainer: Alexander F Rødseth <xyproto@archlinux.org> # Contributor: Daichi Shinozaki <dsdseg@gmail.com> # Contributor: Dwight Schauer <dschauer@gmail.com> # Contributor: Stefan Husmann <stefan-husmann@t-online.de> # Contributor: Christoph Zeiler <archNOSPAM_at_moonblade.dot.org> # Contributor: Michael 'manveru' Fellinger <m.fellinger@gmail.com> # Contributor: Caleb McCombs <erdrick016+aur@gmail.com> # Contributor: Christian Hesse <arch@eworm.de> # ALARM: Kevin Mihelich <kevin@archlinuxarm.org> # - remove unsupported gcc flag on !aarch64 pkgname=neko pkgver=2.1.0 pkgrel=1 pkgdesc='High-level dynamically typed programming language' url='http://nekovm.org/' license=('LGPL') arch=('x86_64' 'i686') depends=('gc' 'gtk2' 'libmariadbclient' 'sqlite' 'apache' 'mbedtls') makedepends=('pkgconfig' 'apr' 'git' 'ninja' 'mbedtls' 'cmake') options=('!strip') source=("git://github.com/HaxeFoundation/neko#tag=v${pkgver//./-}") sha256sums=('SKIP') prepare() { if [[ $CARCH != "aarch64" ]]; then sed -i '/mincoming-stack-boundary/d' $pkgname/CMakeLists.txt; fi } build() { mkdir -p build cd build cmake "../$pkgname" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ -GNinja ninja } package() { DESTDIR="$pkgdir" ninja -C build install } # getver: nekovm.org/download # vim:set ts=2 sw=2 et:
true
f2b79eb1cd08d7c81e9d9d039e7695ef19f82bfe
Shell
AndyA/dvdbot
/bravo2/bin/autoBurn
WINDOWS-1252
12,600
3.15625
3
[]
no_license
#!/bin/sh # roboticke paleni a tisk ze slozky na Bravo II # robot for burn and print from folder to Bravo II # version 0.1.2 David Fabel (c) 2007 . /srv/bravo2/bin/bravo2function.sh . /srv/bravo2/bin/scriptFunction . /srv/bravo2/bravoSourceMedia LOGLEVEL="2" bravo {R} startLog bravoWorkDir="/srv/bravo2/bravoRobot" bravoTmpDir="/srv/bravo2/bravoTmp" #bravoErrorPNM="/srv/bravo2/bin/ERROR.pnm" lastSource="" leftSource=$(echo "$leftSource" | tr "[:upper:]" "[:lower:]") rightSource=$(echo "$rightSource" | tr "[:upper:]" "[:lower:]") function detectFormat() { logMsg 5 "startuje detectFormat" size=$(wc -c "$1" | sed "s| .*||") format=$(echo -e "$1" | sed "s|.*\.||" | tr "[:upper:]" "[:lower:]" | grep "dvd" | sed "s|.*dvd.*|dvd|") logMsg 3 "Soubor '$1' ma velikost: '$size' a format: '$format'" if [ "$size" -gt "750000000" ] || [ "$format" = "dvd" ]; then logMsg 2 "Detekovan format: '$format'" echo "dvd" else logMsg 2 "Urcen format: 'cd'" echo "cd" fi logMsg 5 "konci detectFormat" } function detectCopies() { logMsg 5 "startuje detectCopies" copies=$(echo -e "$1" | sed "s|.*\.||" | grep -i "[0-9]\+x" | sed -e "s|\([0-9]\+\)[xX].*|~\1|" \ -e "s|.*~||" ) if [ -z "$copies" ]; then copies=1 fi logMsg 3 "Soubor '$1' ma pocet kopii: '$copies'" echo $copies logMsg 5 "konci detectCopies" } function detectTest() { logMsg 5 "startuje detectTest" test=$(echo -e "$1" | sed "s|.*\.||" | grep -i "_t$") if [ -n "$test" ]; then test=true else test=false fi logMsg 3 "Soubor '$1' ma nastaveno testovani: '$test'" echo $test logMsg 5 "konci detectTest" } function getSourceMedia() { logMsg 5 "startuje getSourceMedia" format=$(detectFormat "$1") if [ "$format" = "$leftSource" ] && [ "$format" = "$rightSource" ]; then logMsg 2 "Soubor '$1' ma format: '$format' ktery je v obou zdrojich" if [ "$lastSource" = "{~~}" ]; then logMsg 4 "Beru z praveho '{~~}'" echo {~~} else logMsg 4 "Beru z leveho '{~~}'" echo {~~} fi else if [ "$format" = "$leftSource" ]; then logMsg 2 "Soubor '$1' ma format: '$format' ktery je v levem zdroji" echo {~~} else if [ "$format" = "$rightSource" ]; then logMsg 2 "Soubor '$1' ma format: '$format' ktery je v pravem zdroji" echo {~~} else logMsg 1 "Soubor '$1' ma format: '$format' ktery neni na zadnem zdroji (vlevo: '$leftSource', vpravo: '$rightSource')" fi fi fi logMsg 5 "konci getSourceMedia" } function decrementCopyCounter() { logMsg 5 "startuje decrementCopyCounter" copies=$(detectCopies "$1") logMsg 2 "Soubor '$1' ma stanoven pocet kopii: '$copies'" if [ "$copies" -eq 1 ]; then logMsg 2 "Soubor '$1' mel byt jen v 1 kopii, a bude smazan" rm -f "$1" else newCopies=$(( $copies - 1 )) newName=$(echo "$1" | sed "s|\(.*\.\)\(.*\)${copies}x|\1\2${newCopies}x|") logMsg 2 "Soubor '$1' bude prejmenovan na '$newName'" mv "$1" "$newName" fi logMsg 5 "konci decrementCopyCounter" } function getFileName() { logMsg 5 "startuje getFileName" name=$(cd "$bravoWorkDir" ls -1 "$1"* 2>/dev/null | grep "^$1\.$2") echo -e "$name" logMsg 5 "konci getFileName" } function setDriveSource() { logMsg 5 "startuje setDriveSource" . "$sourceMedia" leftSource=$(echo "$leftSource" | tr "[:upper:]" "[:lower:]") rightSource=$(echo "$rightSource" | tr "[:upper:]" "[:lower:]") echo "#soubor aktualniho obsazeni leveho, vypalovacky a praveho zdroje leftSource=\"$leftSource\" burnDrive=\""$1"\" rightSource=\"$rightSource\" " > "$sourceMedia" logMsg 5 "konci setDriveSource" } function selectJob() { logMsg 5 "startuje selectJob" . /srv/bravo2/bravoSourceMedia leftSource=$(echo "$leftSource" | tr "[:upper:]" "[:lower:]") rightSource=$(echo "$rightSource" | tr "[:upper:]" "[:lower:]") logMsg 4 "leftSource: '$leftSource', type: '$1', driveSource: '$2'" if [ -n "$leftSource" ]; then leftEntry=$(ls -1r 2>/dev/null | grep -i "\.$1\." | grep -v "^$2\." | sed "s|.*\.||" | tr "[:upper:]" "[:lower:]" | grep "$leftSource" | sed "s|\..*||" | uniq | head -n1) fi # isoName=$(getFileName "$leftEntry" "iso") # logMsg 3 "Ulohy pro levy zasobnik: '$leftEntry' ('$1', '$2', '$isoName')" # if [ "$1" = "pnm" ] && [ -n "$isoName"]; then # leftEntry="" # fi # logMsg 3 "Ulohy pro levy zasobnik: '$leftEntry' po vyrazeni iso uloh" logMsg 4 "rightSource: '$rightSource', type: '$1', driveSource: '$2'" if [ -n "$rightSource" ]; then rightEntry=$(ls -1r 2>/dev/null | grep -i "\.$1\." | grep -v "^$2\." | sed "s|.*\.||" | tr "[:upper:]" "[:lower:]" | grep "$rightSource" | sed "s|\..*||" | uniq | head -n1) fi # isoName=$(getFileName "$rightEntry" "iso") # logMsg 3 "Ulohy pro pravy zasobnik: '$rightEntry' ('$1', '$2', '$isoName')" # if [ "$1" = "pnm" ] && [ -n "$isoName"]; then # rightEntry="" # fi # logMsg 3 "Ulohy pro pravy zasobnik: '$rightEntry' po vyrazeni iso uloh" logMsg 4 "leftEntry: '$leftEntry', rightEntry: '$rightEntry'" # detekuji zda jsou ulohy pro oba zasobniky if [ -n "$leftEntry" ] && [ -n "$rightEntry" ]; then entry=$(ls -1r 2>/dev/null | grep -i "\.$1\." | grep -v "^$2\." | sed "s|\..*||" | uniq | head -n1) logMsg 2 "Existuji ulohy pro oba zasobniky, vybrana nejstarsi uloha ve fronte: '$entry'" else if [ -n "$leftEntry" ]; then entry=$(ls -1r 2>/dev/null | grep -i "\.$1\." | grep -v "^$2\." | grep "$leftEntry" | sed "s|\..*||" | uniq | head -n1) logMsg 2 "Existuji ulohy pro levy zasobnik, vybrana nejstarsi uloha ve fronte: '$entry'" else if [ -n "$rightEntry" ]; then entry=$(ls -1r 2>/dev/null | grep -i "\.$1\." | grep -v "^$2\." | grep "$rightEntry" | sed "s|\..*||" | uniq | head -n1) logMsg 2 "Existuji ulohy pro pravy zasobnik, vybrana nejstarsi uloha ve fronte: '$entry'" else entry="" logMsg 3 "Bohuzel pro dane zdroje: ($leftSource/$rightSource) nejsou ulohy" fi fi fi isoName=$(getFileName "$entry" "iso") logMsg 3 "Vybrana uloha: '$entry' ('$1', '$2', '$isoName')" if [ "$1" = "pnm" ] && [ -n "$isoName" ]; then entry="" fi logMsg 3 "Vybrana uloha po vyrazeni iso uloh: '$entry'" echo -e "$entry" logMsg 5 "konci selectJob" } check eject #check scsitape check sed check tr check grep check sleep check cdrecord check mkisofs check pngtopnm check jpgtopnm #check veci kolem brava bravo {R} cd "$bravoWorkDir" #getData #getDataBurn statusPrinter=$(getStatus printer) logMsg 2 "Vycistime tiskarnu: '$statusPrinter'" if [ "$statusPrinter" = "O" ]; then logMsg 2 "Zavreme dvirka od tiskarny" bravo {=c} fi if [ "$statusPrinter" = "D" ]; then logMsg 2 "Odstranime nezname CD z tiskarny" bravo {=_} fi statusBurn=$(getStatus burn) setStatusBurn "?" #setStatusBurnMedia logMsg 2 "Vycistime burnDrive: '$statusBurn'" if [ "$statusBurn" = "O" ]; then logMsg 2 "Zavreme dvirka od vypalovacky" bravo {-c} fi if [ "$statusBurn" = "D" ]; then logMsg 2 "Odstranime nezname CD z vypalovacky" bravo {-e} {~-~} {^} {-c} {-_} fi setDriveSource "" while true; do cd "$bravoWorkDir" iso="" picture="" . /srv/bravo2/bravoSourceMedia leftSource=$(echo "$leftSource" | tr "[:upper:]" "[:lower:]") rightSource=$(echo "$rightSource" | tr "[:upper:]" "[:lower:]") # getData # if [ -z "$burnDrive" ] && [ "$statusBurn" == "B" ]; then # logMsg 3 "Neni co palit a pritom je status burn. Nastavime neznamy stav" # setStatusBurn "?" # fi statusBurn=$(getStatus burn) statusPrinter=$(getStatus printer) if [ -n "$burnDrive" ] && [ "$statusBurn" != "B" ]; then logMsg 3 "Zjistujeme status mechaniky (soucasny je '$status')" # setStatusBurnMedia # getDataBurn statusBurn=$(getStatus burn) fi if [ "$statusBurn" = "E" ]; then error=$(getBurnError) logMsg 1 "Uloha: '$burnDrive' skoncila spatne: '$error'" bravo {-e} {~-~} {^} {-c} {-_} setStatusBurn "?" statusBurn=$(getStatus burn) fi if [ "$statusBurn" = "D" ]; then logMsg 2 "Dopalili jsme ulohu: '$burnDrive'" iso=$(getFileName "$burnDrive" "iso") decrementCopyCounter "$iso" setDriveSource "" iso="" picture=$(getFileName "$burnDrive" "pnm") if [ -z "$picture" ]; then logMsg 3 "Vypalena uloha nema potisk" bravo {-e} {~-~} {^} {-c} {-_} else logMsg 3 "Vypalena uloha se bude i tisknout" bravo {-e} {-=} {-c} {=c} fi . /srv/bravo2/bravoSourceMedia leftSource=$(echo "$leftSource" | tr "[:upper:]" "[:lower:]") rightSource=$(echo "$rightSource" | tr "[:upper:]" "[:lower:]") statusBurn=$(getStatus burn) statusPrinter=$(getStatus printer) fi logMsg 3 "Stav1 Iso: '$iso', picture: '$picture'" if [ "$statusBurn" = "I" ]; then logMsg 3 "Drive je prazdny" iso="" # picture="" fi logMsg 3 "Stav2 Iso: '$iso', picture: '$picture'" if [ "$statusBurn" = "B" ]; then logMsg 1 "Prave palime: '$burnDrive'" iso=$(getFileName "$burnDrive" "iso") picture="" fi logMsg 3 "Stav3 Iso: '$iso', picture: '$picture', burnDrive: '$burnDrive'" if [ -z "$iso" ]; then logMsg 3 "Podivame se po nove uloze k paleni" # entry=$(selectJob "iso" "$burnDrive") entry=$(selectJob "iso" "^$") logMsg 4 "entry: '$entry'" if [ -n "$entry" ]; then # iso=$(ls $entry.iso* 2>/dev/null | # sed "s|.*/||") iso=$(getFileName "$entry" "iso") logMsg 4 "iso: '$iso'" else iso="" fi fi logMsg 3 "Stav4 Iso: '$iso', picture: '$picture', status burn: '$statusBurn'" if [ -n "$iso" ] && [ "$statusBurn" != "B" ]; then lastSource=$(getSourceMedia "$iso") logMsg 2 "Budeme palit ulohu '$iso' ze zdroje '$lastSource'" if [ -n "$lastSource" ]; then bravo $lastSource {^} {~-~} {-e} {v} {-c} jobName=${iso%\.${iso#*\.}} setDriveSource "$jobName" . /srv/bravo2/bravoSourceMedia leftSource=$(echo "$leftSource" | tr "[:upper:]" "[:lower:]") rightSource=$(echo "$rightSource" | tr "[:upper:]" "[:lower:]") logMsg 2 "Nastaveno jmeno ulohy '$jobName' do sourceMedia" if [ $(detectTest $iso) ]; then logMsg 2 "Spusteno paleni a overeni ulohy '$iso'" bravoBurn "$iso" verify else logMsg 2 "Spusteno paleni ulohy '$iso'" bravoBurn "$iso" fi fi else logMsg 2 "Zadna uloha pro paleni" fi logMsg 3 "Stav5 Iso: '$iso', picture: '$picture', burnDrive: '$burnDrive'" if [ -z "$picture" ]; then logMsg 3 "Podivame se po nove uloze k tisku" entry=$(selectJob "pnm" "$burnDrive") if [ -n "$entry" ]; then picture="$(ls "$entry"*.pnm* 2>/dev/null | sed "s|.*/||")" else picture="" fi fi logMsg 3 "Stav6 entry: '$entry' Iso: '$iso', picture: '$picture', status burn: '$statusBurn', status printer: '$statusPrinter'" if [ -n "$picture" ] && [ "$statusPrinter" = "D" ]; then logMsg 2 "Budeme tisknout ulohu '$picture', ktera se prave dopalila" bravoPrint "$picture" decrementCopyCounter "$picture" picture="" sleep 5 bravo {=e} {~=~} {^} {=c} {-_} fi logMsg 3 "Stav7 Iso: '$iso', picture: '$picture', status printer: '$statusPrinter'" if [ -n "$picture" ] && [ "$statusPrinter" != "D" ]; then lastSource=$(getSourceMedia "$picture") logMsg 2 "Budeme tisknout ulohu '$picture' ze zdroje '$lastSource'" if [ -n "$lastSource" ]; then bravo $lastSource {^} {~=~} {=e} {v} {=c} bravoPrint "$picture" decrementCopyCounter "$picture" picture="" sleep 5 sleep 1 bravo {=e} {~=~} {^} {=c} {-_} fi else logMsg 2 "Zadna uloha pro tisk" sleep 10 fi done endLog
true
7f871e2dec1b8fbe0867e702ec624c37008402cd
Shell
zeroDuke/MyProject
/testzh.sh
UTF-8
1,092
4.15625
4
[]
no_license
#! /bin/bash vflag=off filename="" output="" function usage() { echo "USAGE:" echo " $0 [-h] [-v] [-f <filename>] [-o <filename>]" exit 1 } while getopts :hvf:o: opt do case "$opt" in v) vflag=on ;; f) filename=$OPTARG if [ ! -f $filename ] then echo "The source file $filename doesn't exist!" exit fi ;; o) output=$OPTARG if [ ! -d `dirname $output` ] then echo "The output path `dirname $output` doesn't exist!" exit fi ;; h) usage exit ;; :) echo "The option -$OPTARG requires an argument." exit 1 ;; ?) echo "Invalid option: -$OPTARG" usage exit 2 ;; esac done
true
f72a4e337fc2ef472f4d7094c05c28178a086823
Shell
adelehedde/bash-utils
/test/utils/assert_test.sh
UTF-8
1,865
3.5
4
[ "Apache-2.0" ]
permissive
#!/bin/bash source "$BASH_UTILS_HOME"/test/unit_test.sh source "$BASH_UTILS_HOME"/test/assert_test.sh source "$BASH_UTILS_HOME"/utils/assert.sh unit_test::before_all() { test_directory="$BASH_UTILS_HOME/_tests" if [[ -d "$test_directory" ]]; then rm -r "$test_directory"; mkdir "$test_directory"; else mkdir "$test_directory"; fi } unit_test::after_all() { rm -r "$test_directory" } test::should_assert_not_empty() { assert::not_empty "argument" "<argument> cannot be empty" && \ assert::not_empty "argument" } test::should_exit_when_argument_is_empty() { local empty_var="" assert_test::exit "assert::not_empty" && \ assert_test::exit "assert::not_empty $empty_var" && \ assert_test::exit "assert::not_empty $empty_var $empty_var" } test::should_assert_file_exists() { touch "$test_directory/file.csv" assert::file_exists "$test_directory/file.csv" "<file> must exists" && \ assert::file_exists "$test_directory/file.csv" } test::should_exit_when_argument_is_empty_or_file_does_not_exist() { local empty_var="" assert_test::exit "assert::file_exists" && \ assert_test::exit "assert::file_exists $empty_var" && \ assert_test::exit "assert::file_exists $empty_var $empty_var" && \ assert_test::exit "assert::file_exists /test.csv" } test::should_assert_directory_exists() { mkdir "$test_directory/folder_test" assert::directory_exists "$test_directory/folder_test" "<directory> must exists" && \ assert::directory_exists "$test_directory/folder_test" } test::should_exit_when_argument_is_empty_or_directory_does_not_exist() { local empty_var="" assert_test::exit "assert::directory_exists" && \ assert_test::exit "assert::directory_exists $empty_var" && \ assert_test::exit "assert::directory_exists $empty_var $empty_var" && \ assert_test::exit "assert::directory_exists /test_folder" } unit_test::run
true
4364714778ed77371e18d07f38e9413dc87ef7e5
Shell
thomas-coudrat/ldm_scripts
/RUN/mkdir
UTF-8
164
2.734375
3
[]
no_license
#!/usr/bin/env bash for ((i=0;i<=1;i++)); do mkdir $i cp backup/* -r $i cd $i sed "s|xxxyyyxxx|$i|g" control-script -i cd ../ echo $i done
true
a48a4ad983fc08895bc415c8f5e98f5f3878b3cb
Shell
jcook3701/trash-bot-maps
/unlink_projects.sh
UTF-8
239
3.4375
3
[ "MIT" ]
permissive
#!/bin/bash pushd ./gazebo/ > /dev/null PROJECTS=(*) for PROJECT in ${PROJECTS[@]} do if [ -d ~/.gazebo/models/${PROJECT} ] then echo "$PROJECT link has been removed." rm ~/.gazebo/models/${PROJECT} fi done popd > /dev/null
true
97e01a263013f88c964c22899b3ecf8d27c91955
Shell
infinispan/infinispan-operator
/scripts/ci/kind-with-olm.sh
UTF-8
506
2.625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash set -o errexit SCRIPT_DIR=$(dirname "$0") OLM_VERSION="v0.21.2" source $SCRIPT_DIR/kind.sh operator-sdk olm install --version ${OLM_VERSION} # Sometimes olm install does not wait long enough for deployments to be rolled out kubectl wait --for=condition=available --timeout=60s deployment/catalog-operator -n olm kubectl wait --for=condition=available --timeout=60s deployment/olm-operator -n olm kubectl wait --for=condition=available --timeout=60s deployment/packageserver -n olm
true
4ae2fad8d44e7c91401d6c4c6e1af789c1792ea1
Shell
tenx-tech/rust-crowbar
/builder/build.sh
UTF-8
319
3.125
3
[ "MIT", "Apache-2.0" ]
permissive
#!/bin/bash set -euo pipefail export CARGO_TARGET_DIR=$(mktemp -d) ( if [[ $# -gt 0 ]]; then yum install -y "$@" fi . $HOME/.cargo/env cargo build ${CARGO_FLAGS:-} --release ) 1>&2 cd $CARGO_TARGET_DIR/release ( strip liblambda.so zip lambda.zip liblambda.so ) 1>&2 exec cat lambda.zip
true
4a081b364265951081578477b9bca17660f6c7ee
Shell
fritzr/home-scripts
/.bashrc.d/10_functions_aliases/tstamp
UTF-8
2,293
3.984375
4
[ "MIT" ]
permissive
# # Time-stamping (for make(1)-like build cache-ing behavior). # _TSTAMPDIR=${XDG_RUNTIME_DIR}/bashrc # tstamp_file # # Prints the name of the timestamp database used by the tstamp_* functions. # tstamp_file() { echo "${_TSTAMPDIR}/${HOSTNAME}.sqlite3" } _TSTAMP_SQLOG="$HOME/logs/tstamp-sqlite.log" : ${SQLITE3:=$(command -v sqlite3)} # tstamp_init # # Initialize the timestamp database used by tstamp_update(). # Returns non-zero on error. # tstamp_init() { mkdir -p $_TSTAMPDIR 2>/dev/null || return 1 local db=$(tstamp_file) if [[ ! -e "$db" ]]; then "${SQLITE3:-sqlite3}" -echo "$db" \ "CREATE TABLE IF NOT EXISTS files( filename TEXT UNIQUE, last_updated INTEGER )" >>$_TSTAMP_SQLOG 2>&1 fi } # tstamp_update <filename> # # Checks whether a file needs to be updated relative to the last time this # function was called on it. # # Returns 0 if the file is newer than the last call to tstamp_update <filename>. # Returns 1 if the file is older then the last call to tstamp_update <filename>. # Returns 2 if something goes wrong. # # For example: # $ touch /tmp/foo # $ tstamp_update /tmp/foo ; echo $? # 0 # $ tstamp_update /tmp/foo ; echo $? # 1 # $ touch /tmp/foo # $ tstamp_update /tmp/foo ; echo $? # 0 # tstamp_update() { local dbfile="$(tstamp_file)" local filename="$(readlink -f -- "$1")" if [[ $# -lt 1 ]]; then return 2 fi local file_time= file_time=$(/usr/bin/stat -c%Y "$filename") || return 2 # Check the last update time. local last_updated= last_updated=$("${SQLITE3:-sqlite3}" -noheader "$dbfile" \ "SELECT last_updated FROM files WHERE filename = '$filename'" \ 2>>$_TSTAMP_SQLOG) || return 2 # If the file doesn't contain an entry, update it and insert one. local ret= if [[ -z "$last_updated" ]]; then # yes update last_updated=$file_time ret=0 else # update if the file is newer [[ $last_updated -lt $file_time ]] ret=$? fi # If we do need to update, then update if [[ $ret -eq 0 ]]; then "${SQLITE3:-sqlite3}" -echo "$dbfile" \ "INSERT OR REPLACE INTO files(filename, last_updated) VALUES('$filename', $file_time)" \ >>$_TSTAMP_SQLOG 2>&1 || return 2 fi return $ret } # vim: set ft=sh:
true
e53e2aa3320caf0133b9805ea93d4dccfb2cfaac
Shell
aehall26/EcologicalGenomics
/myscripts/process_bam.sh
UTF-8
1,261
3.84375
4
[]
no_license
#!/bin/bash # this is where our output sam files are goin gto get converted into binary format (bam) # Then were going to sort the bam files, remove the PCR duplicates, and index the duplicates #first let's convert sam to bam and then we sort #for f in ${output}/BWA/${mypop}*.sam #do #out=${f/.sam} #substitute the sam because we'll change it out for a .bam #sambamba-0.7.1-linux-static view -S --format=bam ${f} -o ${out}.bam #this is specific to our server -S means its a sam file. then we'll format this into a bam file #samtools sort ${out}.bam -o ${out}.sorted.bam #output into a sorted.bam file #done #now let's remove the PCR duplicates beause we dont want the pseudo repolication that those represent for file in ${output}/BWA/${mypop}*.sorted.bam do f=${file/.sorted.bam/} sambamba-0.7.1-linux-static markdup -r -t 1 ${file} ${f}.sorted.rmdup.bam #file is defined above. #marks the PCR duplicates and removes them. # Assumes it's a dupiicate if you have more than one read with the exact same start and end place. done #now to finish, we'll index our files. index creates coordinates on the file which allow for quick look up and retrieval for file in ${output}/BWA/${mypop}*.sorted.rmdup.bam do samtools index ${file} done
true
1bbc84eb57ff101e9ce8d53c20bf4f2ae2c73dd3
Shell
pmav99/newdot
/common/.local/my_bin/bak
UTF-8
1,060
4.1875
4
[]
no_license
#!/usr/bin/env bash # # Backup a file by appending '.bak' or a timestamp. # #set -euxo pipefail set -euo pipefail display_usage () { echo 'Backup a file by appending "bak" or (optionally) a timestamp.' echo 'Usage: bak [-t] <path>' } # Bail out early if [[ ( $# -gt 2 ) || ( $# -eq 0) ]]; then display_usage exit 1 fi # Read CLI arguments using getopt cli_options=$(getopt -o th --long help -- "$@") [ $? -eq 0 ] || { echo "Incorrect options provided" exit 1 } eval set -- "$cli_options" # default values extension='bak' path='' # Parse getopt arguments while true; do case "$1" in -h | --help ) display_usage exit 0 ;; -t | --timestamp ) extension=$(/bin/date +"%y%m%d_%H%M%S") shift ;; --) shift; path=$1; break;; esac done /bin/cp -r -i "${path}" "${path}.${extension}"
true
1a2c8304a5b6c783dff5e8510d612e1c937d31a1
Shell
jgordon3/VACC_scripts
/incomplete_and_test/deeptools_plotHeatmap.sh
UTF-8
707
3.203125
3
[]
no_license
#!/bin/sh # deeptools_plotHeatmap.sh # BIGWIG=$1 BIGWIG=$(readlink -f $BIGWIG) if [ ! -f "$BIGWIG" ]; then echo "Need valid path to bigwig file"; fi BASE=`basename $BIGWIG` ABRV_NAME=${BASE%.fastq} FILT_FASTQ="${ABRV_NAME}_trim_filt.fastq"; bed=$2 ABRVNAME=$(echo $bigwig | awk -F '_' '{print $1"_"$2}') echo $ABRVNAME compmat="$ABRVNAME.computematrix" plotout="$ABRVNAME.png" BEDNAME=$(echo $bed | awk -F '_' '{print $1"_"$2}') reglabel="$BEDNAME_peaks" computeMatrix reference-point -S $bigwig -R $bed -a 1000 -b 1000 -out $compmat --referencePoint center plotHeatmap -m $compmat -out $plotout --heatmapHeight 15 --refPointLabel peak.center --regionsLabel "$reglabel" --plotTitle "$ABRVNAME"
true
0e02cf4cf2f3babefd6e9a7167e6d79c8b5c3f0d
Shell
electricintel/bko
/bko/live/knoppix/5.11/linuxrc
UTF-8
31,735
3.15625
3
[]
no_license
#!/static/sh # # KNOPPIX General Startup Script # (C) Klaus Knopper <knoppix@knopper.net> # License: GPL V2. # # This script needs some of the builtin ash commands (if, test, ...) # mount/umount, insmod/rmmod are also a builtin in ash-knoppix. # # Just informational: This is a CD or DVD edition MEDIUM="CD" # hardcoded configurable options # Default maximum size of dynamic ramdisk in kilobytes RAMSIZE=1000000 # End of options # Don't allow interrupt signals trap "" 1 2 3 11 15 MODULE_DIRS="/cdrom/KNOPPIX/modules /cdrom2/KNOPPIX/modules /modules" # "Safe" SCSI modules in the right order for autoprobe # Warning: The sym53c8xx.ko and g_NCR* cause a kernel Oops if no such adapter # is present. # # NB: It looks like that ncr53c8xx.ko is more stable than 53c7,8xx.ko for # a ncr53c810 controller (at least on my installation box it's more # immune to SCSI timeouts) # Removed 53c7,8xx -> crashes if no device attached. # Removed AM53C974 -> crashes tmscsim if adapter found # Added initio.ko on request (untested) #SCSI_MODULES="aic7xxx.ko aic7xxx_old.ko BusLogic.ko \ #ncr53c8xx.ko NCR53c406a.ko \ #initio.ko mptscsih.ko \ #advansys.ko aha1740.ko aha1542.ko aha152x.ko \ #atp870u.ko dtc.ko eata.ko fdomain.ko gdth.ko \ #megaraid.ko pas16.ko pci2220i.ko pci2000.ko psi240i.ko \ #qlogicfas.ko qlogicfc.ko qlogicisp.ko \ #seagate.ko t128.ko tmscsim.ko u14-34f.ko ultrastor.ko wd7000.ko \ #a100u2w.ko 3w-xxxx.ko" # Obsoleted by /proc/pci lookups # Misc functions # Dynamic program loader # /KNOPPIX is already mounted when this is used. DYNLOADER="/KNOPPIX/lib/ld-linux.so.2" # Builin filesystems BUILTIN_FS="iso9660 ext2 reiserfs vfat ntfs" mountit(){ # Usage: mountit src dst "options" # Uses builtin mount of ash.knoppix for fs in $BUILTIN_FS; do if test -b $1; then options="$3" case "$fs" in vfat) # We REALLY need this for Knoppix on DOS-filesystems shortname="shortname=winnt" [ -n "$options" ] && options="$options,$shortname" || options="-o $shortname" ;; ntfs) ntfsopts="force,silent,umask=0,no_def_opts,allow_other,streams_interface=windows" [ -n "$options" ] && ntfsopts="$options,$ntfsopts" || ntfsopts="-o $ntfsopts" test -x /static/ntfs-3g && /static/ntfs-3g $1 $2 $ntfsopts >/dev/null 2>&1 && return 0 ;; esac mount -t $fs $options $1 $2 >/dev/null 2>&1 && return 0 fi done return 1 } FOUND_SCSI="" FOUND_KNOPPIX="" INTERACTIVE="" HTTPFS="" # Clean input/output exec >/dev/console </dev/console 2>&1 # Reset fb color mode RESET="]R" # ANSI COLORS # Erase to end of line CRE=" " # Clear and reset Screen CLEAR="c" # Normal color NORMAL="" # RED: Failure or error message RED="" # GREEN: Success message GREEN="" # YELLOW: Descriptions YELLOW="" # BLUE: System mesages BLUE="" # MAGENTA: Found devices or drivers MAGENTA="" # CYAN: Questions CYAN="" # BOLD WHITE: Hint WHITE="" # Clear screen with colormode reset # echo "$CLEAR$RESET" # echo "$CLEAR" # Just go to the top of the screen # echo -n "" echo "" # Be verbose echo "${WHITE}Welcome to the ${CYAN}K${MAGENTA}N${YELLOW}O${WHITE}P${RED}P${GREEN}I${BLUE}X${WHITE} live GNU/Linux on ${MEDIUM}"'!'"${NORMAL}" echo "" echo "" # We only need the builtin commands and /static at this point PATH=/static export PATH umask 022 # Mount /proc and /dev/pts mount -t proc /proc /proc # Disable kernel messages while probing modules in autodetect mode echo "0" > /proc/sys/kernel/printk # Kernel 2.6 mount -t sysfs /sys /sys >/dev/null 2>&1 # Read boot command line with builtin cat command (shell read function fails in Kernel 2.4.19-rc1) CMDLINE="$(cat /proc/cmdline)" # Check if we are in interactive startup mode case "$CMDLINE" in *BOOT_IMAGE=expert\ *) INTERACTIVE="yes"; :>/interactive; ;; esac case "$CMDLINE" in *modules-disk*) INTERACTIVE="yes"; ;; esac case "$CMDLINE" in *BOOT_IMAGE=debug\ *|*\ debug*) DEBUG="yes"; ;; esac # Does the user want to skip scsi detection? NOSCSI="" case "$CMDLINE" in *noscsi*|*nobootscsi*) NOSCSI="yes"; ;; esac case "$CMDLINE" in *nousb*|*nobootusb*) NOUSB="yes"; ;; esac case "$CMDLINE" in *nofirewire*|*nobootfirewire*) NOFIREWIRE="yes"; ;; esac NOCD="" case "$CMDLINE" in *fromhd*) NOCD="yes"; ;; esac case "$CMDLINE" in *fromdvd*) FROMDVD="yes"; ;; esac case "$CMDLINE" in *idecd*|*atapicd*) IDECD="yes"; ;; esac case "$CMDLINE" in *noideraid*) NOIDERAID="yes"; ;; esac USB2="ehci-hcd" case "$CMDLINE" in *nousb2*) USB2=""; ;; esac KNOPPIX_DIR="KNOPPIX" KNOPPIX_NAME="KNOPPIX" case "$CMDLINE" in *knoppix_dir=*) KNOPPIX_DIR="$knoppix_dir"; ;; esac case "$CMDLINE" in *knoppix_name=*) KNOPPIX_NAME="$knoppix_name"; ;; esac case "$CMDLINE" in *httpfs=*) HTTPFS="$httpfs"; ;; esac # Print kernel info read a b KERNEL relax >/dev/null 2>&1 </proc/version echo "${GREEN}Running Linux Kernel ${YELLOW}$KERNEL${GREEN}.${NORMAL}" # Get total ramsize, and available real ram in kB. We need this later. # Note that FREEMEM is incorrect, we should add MemCached, # but the difference should be minimal at this point. TOTALMEM=64000 FREEMEM=32000 while read info amount kb; do case "$info" in MemTotal:) test "$amount" -gt "0" >/dev/null 2>&1 && TOTALMEM="$amount";; MemFree:) test "$amount" -gt "0" >/dev/null 2>&1 && FREEMEM="$amount";; esac done </proc/meminfo # Print meminfo. echo "${CRE}${BLUE}Total Memory available: ${YELLOW}${TOTALMEM}kB${BLUE}, Memory free: ${YELLOW}${FREEMEM}kB${BLUE}.${NORMAL}" # New in Knoppix 5.1: cloop preload cache # Default values case "$MEDIUM" in *[Cc][Dd]*) CLOOP_PRELOAD="preload=64" ;; *[Dd][Vv][Dd]*) CLOOP_PRELOAD="preload=128" ;; *) CLOOP_PRELOAD="preload=32" ;; esac # cloop improves seek performance when caching the directory index # (first few MB) of each cloop file. # Default values depending on ramsize, override with cloop_preload=numblocks at boot. if test "$TOTALMEM" -lt 128000; then # up to 128MB: No preload. CLOOP_PRELOAD="" elif test "$TOTALMEM" -lt 256000; then # less than 256MB: About 4MB preload w/ blocksize 128k CLOOP_PRELOAD="preload=32" elif test "$TOTALMEM" -lt 512000; then # less than 512MB: About 8MB preload w/ blocksize 128k CLOOP_PRELOAD="preload=64" elif test "$TOTALMEM" -lt 1024000; then # less than 1GB: About 16MB preload w/ blocksize 128k CLOOP_PRELOAD="preload=128" else # 1GB Ram or more # About 32MB w/ blocksize 128k CLOOP_PRELOAD="preload=256" fi case "$CMDLINE" in *\ nocache*|*\ nocloop_preload*|*\ nopreload*) CLOOP_PRELOAD="" ;; esac [ -n "$cloop_preload" ] && CLOOP_PRELOAD="preload=$cloop_preload" # Run a shell if in debug mode stage=1 rundebugshell(){ if [ -n "$DEBUG" ]; then echo "${CRE}${BLUE}Starting intermediate Shell stage $stage as requested by \"debug\" option.${NORMAL}" echo "${CRE}${BLUE}Type \"exit\" to continue with normal bootup.${NORMAL}" [ -x /static/ash ] && /static/ash || /bin/bash fi } # Mount module disk mountmodules(){ TYPE="$1"; shift echo -n "${CRE}${CYAN}Please insert ${TYPE} modules disk and hit Return. ${NORMAL}" read a echo -n "${CRE}${BLUE}Mounting ${TYPE} modules disk... ${NORMAL}" # We always mount over /modules (because it's there ;-) if mountit /dev/fd0 /modules "-o ro"; then echo "${GREEN}OK.${NORMAL}" return 0 fi echo "${RED}NOT FOUND.${NORMAL}" return 1 } # Unmount module disk umountmodules(){ TYPE="$1"; shift echo -n "${CRE}${BLUE}Unmounting ${TYPE} modules disk... ${NORMAL}" umount /modules 2>/dev/null echo "${GREEN}DONE.${NORMAL}" } # Ask user for modules askmodules(){ TYPE="$1"; shift echo "${BLUE}${TYPE} modules available:${WHITE}" c=""; for m in "$@"; do if test -r "/modules/$m"; then test -z "$c" && { echo -n " $m"; c="1"; } || { echo " $m"; c=""; } fi done [ -n "$c" ] && echo "" echo "${CYAN}Load ${TYPE} Modules?${NORMAL}" echo "${CYAN}[Enter full filename(s) (space-separated), Return for autoprobe, ${WHITE}n${CYAN} for none] ${NORMAL}" echo -n "${CYAN}insmod module(s)> ${NORMAL}" read MODULES case "$MODULES" in n|N) MODULES=""; ;; y|"") MODULES="$*"; ;; esac } # Try to load the given module with optional parameters # module can be a full path or a module.ko name # (in which case $MODULE_DIRS is searched). # loadmodule module options... loadmodule() { MODULE="$1"; shift INSMOD="" # Find insmod in CURRENT file system configuration for p in $MODULE_DIRS /static; do checkfor="$p/insmod" if test -x "$checkfor"; then INSMOD="$checkfor"; break fi done # At last resort, try builtin insmod test -z "$INSMOD" && INSMOD="insmod" # builtin insmod LOAD="" for p in $MODULE_DIRS; do for ext in "" ".ko" ".o"; do checkfor="$p/$MODULE$ext" if test -r "$checkfor"; then LOAD="$checkfor" break 2 fi done done test -n "$LOAD" || return 1 # Fork a new process to avoid crashing our main shell echo "$INSMOD -f $LOAD" "$@" | /static/ash return $? } # Load many modules at once # loadmodules TYPE(comment) module ... loadmodules(){ TYPE="$1"; shift test -n "$INTERACTIVE" && echo "6" > /proc/sys/kernel/printk for m in "$@"; do echo -n "${CRE}${BLUE}Probing ${TYPE}... ${MAGENTA}$m${NORMAL}" if loadmodule "$m" >/dev/null 2>&1; then case "$TYPE" in scsi|SCSI) FOUND_SCSI="yes"; ;; esac fi done test -n "$INTERACTIVE" && echo "0" > /proc/sys/kernel/printk echo -n "${CRE}" } unloadmodule() { MODULE="$1" RMMOD="" # Find rmmod in CURRENT file system configuration for p in $MODULE_DIRS /static; do checkfor="$p/rmmod" if test -x "$checkfor"; then RMMOD="$checkfor"; break fi done # At last resort, try builtin rmmod test -z "$RMMOD" && RMMOD="rmmod" # builtin rmmod # For a new process to avoid crashing our main shell echo "$RMMOD" "$MODULE" | /static/ash return $? } # Check for SCSI, use modules on bootfloppy first ISA_SCSI="aha1740.ko aha1542.ko aha152x.ko pas16.ko psi240i.ko qlogicfas.ko qlogicfc.ko seagate.ko t128.ko u14-34f.ko wd7000.ko" SCSI_PROBE="$ISA_SCSI" # Trying to do kind of /proc/pci hardware detection # SCSI detection using /sys/devices for d in /sys/devices/*/*; do if test -r "$d"/class -a -r "$d"/vendor -a -r "$d"/device; then read CLASS < "$d"/class 2>/dev/null case "$CLASS" in 0x0100*) read VENDOR < "$d"/vendor 2>/dev/null read DEVICE < "$d"/device 2>/dev/null case "$VENDOR:$DEVICE" in *1000:*00[0-2]?) SCSI_PROBE="$SCSI_PROBE sym53c8xx.ko" ;; *1000:*040?|*1000:*196?|*101e:*196?|*1028:*000[ef]|*1028:*0013) SCSI_PROBE="$SCSI_PROBE megaraid_mbox.ko" ;; *1000:*04[1-9]?|*1028:*0015) SCSI_PROBE="$SCSI_PROBE megaraid_sas.ko" ;; *1001:*9100|*1101:*) SCSI_PROBE="$SCSI_PROBE initio.ko" ;; *9004:*|*9005:*00??) SCSI_PROBE="$SCSI_PROBE aic7xxx.ko" ;; *1011:*|*1028:*000[1-9a]|*9005:*02[08]?) SCSI_PROBE="$SCSI_PROBE aacraid.ko" ;; *1014:*002e|*1014:*01bd|*9005:*0250) SCSI_PROBE="$SCSI_PROBE ips.ko" ;; *1014:*0[1-2]8?|*1069:*|*9005:*0503) SCSI_PROBE="$SCSI_PROBE ipr.ko" ;; *1022:*) SCSI_PROBE="$SCSI_PROBE tmscsim.ko" ;; *1044:*) SCSI_PROBE="$SCSI_PROBE dpt_i2o.ko" ;; *1077:*1???) SCSI_PROBE="$SCSI_PROBE qla1280.ko" ;; *1077:*21??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2100.ko" ;; *1077:*22??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2200.ko" ;; *1077:*23[0-1]?) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2300.ko" ;; *1077:*232?) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2322.ko" ;; *1077:*24??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko" ;; *1077:*63??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla6312.ko" ;; *10df:*) SCSI_PROBE="$SCSI_PROBE lpfc.ko" ;; *10fc:*|*1145:*) SCSI_PROBE="$SCSI_PROBE nsp32.ko" ;; *1101:*) SCSI_PROBE="$SCSI_PROBE a100u2w.ko" ;; *1119:*|*8086:*) SCSI_PROBE="$SCSI_PROBE gdth.ko" ;; *1191:*) SCSI_PROBE="$SCSI_PROBE atp870u.ko" ;; *134a:*) SCSI_PROBE="$SCSI_PROBE dmx3191d.ko" ;; *1de1:*) SCSI_PROBE="$SCSI_PROBE dc395x.ko" ;; *9005:*8???) SCSI_PROBE="$SCSI_PROBE aic79xx.ko" ;; *104b:*) SCSI_PROBE="$SCSI_PROBE BusLogic.ko" ;; *1[0d]e1:*) SCSI_PROBE="$SCSI_PROBE dc395x.ko" ;; *1000:*00[34]?) SCSI_PROBE="$SCSI_PROBE mptscsih.ko" ;; *10cd:*) SCSI_PROBE="$SCSI_PROBE advansys.ko" ;; *1191:*) SCSI_PROBE="$SCSI_PROBE atp870u.ko" ;; *134a:*) SCSI_PROBE="$SCSI_PROBE dtc.ko" ;; *1d44:*) SCSI_PROBE="$SCSI_PROBE eata.ko" ;; *1036:*) SCSI_PROBE="$SCSI_PROBE fdomain.ko" ;; *1256:*4201) SCSI_PROBE="$SCSI_PROBE pci2220i.ko" ;; *1256:*5201) SCSI_PROBE="$SCSI_PROBE pci2000.ko" ;; *1022:*) SCSI_PROBE="$SCSI_PROBE tmscsim.ko" ;; *6356:*) SCSI_PROBE="$SCSI_PROBE ultrastor.ko" ;; *13c1:*) SCSI_PROBE="$SCSI_PROBE 3w-xxxx.ko" ;; esac ;; esac fi done # Load fuse, we may need it to access ntfs filesystems loadmodule fuse >/dev/null 2>&1 if test -n "$INTERACTIVE"; then # Let the user select interactively askmodules SCSI $(cd /modules; echo *.ko) else # these are the autoprobe-safe modules MODULES="$SCSI_PROBE" fi test -z "$NOSCSI" && test -n "$MODULES" && loadmodules SCSI $MODULES # End of SCSI check # Check for IDE-Raid devices if test -z "$NOIDERAID"; then ( { loadmodule ataraid.ko && loadmodule silraid.ko; } || loadmodule medley.ko || loadmodule pdcraid.ko ) >/dev/null 2>&1 fi # End of IDE-Raid check # Check for USB, use modules on bootfloppy first if test -z "$NOUSB"; then echo -n "${CRE}${BLUE}Checking for USB...${NORMAL}" if loadmodule usbcore.ko >/dev/null 2>&1; then FOUNDUSB="" for i in $USB2 uhci-hcd ohci-hcd; do loadmodule $i >/dev/null 2>&1 && FOUNDUSB="yes" done if test -n "$FOUNDUSB"; then loadmodule libusual.ko >/dev/null 2>&1 loadmodule ff-memless.ko >/dev/null 2>&1 loadmodule usbhid.ko >/dev/null 2>&1 loadmodule ub.ko >/dev/null 2>&1 || loadmodule usb-storage.ko >/dev/null 2>&1 else # For an unknown reason, unloading usbcore hangs sometimes # rmmod usbcore >/dev/null 2>&1 true fi fi echo -n "${CRE}" fi # End of USB check # Check for Firewire, use modules on bootfloppy first if test -z "$NOFIREWIRE"; then echo -n "${CRE}${BLUE}Checking for Firewire...${NORMAL}" if loadmodule ieee1394.ko >/dev/null 2>&1; then FOUNDFIREWIRE="" for i in ohci1394.ko; do echo -n "${CRE}${BLUE}Loading $i...${NORMAL}" loadmodule "$i" >/dev/null 2>&1 && FOUNDFIREWIRE="yes" done if test -n "$FOUNDFIREWIRE"; then echo -n "${CRE}${BLUE}Loading sbp2.ko...${NORMAL}" loadmodule sbp2.ko serialize_io=1 >/dev/null 2>&1 else # For an unknown reason, unloading ieee1394 hangs sometimes # echo -n "${CRE}${BLUE}Unloading ieee1394...${NORMAL}" # rmmod ieee1394 >/dev/null 2>&1 true fi fi echo -n "${CRE}" fi # End of FIREWIRE check # Unfortunately, hotpluggable devices tend to need some time in order to register if test -n "$FOUNDUSB" -o -n "$FOUNDFIREWIRE"; then echo -n "${CRE}${BLUE}Scanning for USB/Firewire devices... ${NORMAL}" if test -n "$FOUNDFIREWIRE"; then # Wait for driver to register sleep 2 # Kernel 2.6 does this automatically case "$(cat /proc/version 2>/dev/null)" in *version\ 2.6.*) ;; *) for host in 0 1 2 3 4 5 6 7; do for channel in 0 1; do for id in 0 1 2 3 4 5 6 7; do echo "scsi add-single-device $host $channel $id 0" >/proc/scsi/scsi 2>/dev/null; done; done; done ;; esac fi sleep 6 echo "${BLUE}Done.${NORMAL}" fi # Check for misc modules in expert mode if test -n "$INTERACTIVE"; then another=""; answer="" while test "$answer" != "n" -a "$answer" != "N"; do echo -n "${CYAN}Do you want to load additional modules from$another floppy disk? [${WHITE}Y${CYAN}/n] ${NORMAL}" another=" another" read answer case "$answer" in n*|N*) break; ;; esac if mountmodules new; then askmodules new $(cd /modules; echo *.ko) test -n "$MODULES" && loadmodules new $MODULES umountmodules current fi done fi # All interactively requested modules should be loaded now. # Give USB-Storage devices some more time to register if test -d /proc/scsi/usb-storage; then echo -n "${CRE}${BLUE}Allowing slow USB-devices some more time to register...${NORMAL}" ash -c "sleep 6" echo "${BLUE}Ok.${NORMAL}" fi # Check for ide-scsi supported CD-Roms et al. test -r /proc/scsi/scsi && FOUND_SCSI="yes" # Disable kernel messages again echo "0" > /proc/sys/kernel/printk # We now enable DMA right here, for faster reading/writing from/to IDE devices # in FROMHD or TORAM mode case "$CMDLINE" in *\ nodma*) ;; *) for d in $(cd /proc/ide 2>/dev/null && echo hd[a-z]); do if test -d /proc/ide/$d; then MODEL="$(cat /proc/ide/$d/model 2>/dev/null)" test -z "$MODEL" && MODEL="[GENERIC IDE DEVICE]" echo "${BLUE}Enabling DMA acceleration for: ${MAGENTA}$d ${YELLOW}[${MODEL}]${NORMAL}" echo "using_dma:1" >/proc/ide/$d/settings fi done ;; esac #mounting iso image over HTTP. /mount_http_iso.sh $HTTPFS # test if knoppix is there if test -r /cdrom/$KNOPPIX_DIR/$KNOPPIX_NAME; then echo -n "${CRE}${GREEN}Accessing KNOPPIX ${MEDIUM} at ${MAGENTA}$HTTPFS${GREEN}...${NORMAL}" FOUND_KNOPPIX="HTTPFS" break fi stage=1 rundebugshell # Now that the right SCSI driver is (hopefully) loaded, try to find CDROM DEVICES="/dev/hd?" test -n "$FOUND_SCSI" -a -z "$NOCD" && DEVICES="/dev/scd? /dev/scd?? $DEVICES" test -n "$FOUNDUSB$FOUNDFIREWIRE" -a -z "$NOCD" && DEVICES="/dev/sr? $DEVICES" # New: Also try parallel port CD-Roms [for Mike]. DEVICES="$DEVICES /dev/pcd?" # New: also check HD partitions for a KNOPPIX/KNOPPIX image test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES="$DEVICES /dev/sd? /dev/sd?[1-9] /dev/sd?[1-9][0-9]" DEVICES="$DEVICES /dev/ub?[1-9] /dev/ub?[1-9][0-9] /dev/ub? /dev/hd?[1-9] /dev/hd?[1-9][0-9]" case "$CMDLINE" in *fromhd=/dev/*) DEVICES="$fromhd"; ;; esac for i in $DEVICES; do echo -n "${CRE}${BLUE}Looking for ${MEDIUM} in: ${MAGENTA}$i${NORMAL} " if mountit $i /cdrom "-o ro" >/dev/null 2>&1; then if test -r /cdrom/$KNOPPIX_DIR/$KNOPPIX_NAME; then echo -n "${CRE}${GREEN}Accessing KNOPPIX ${MEDIUM} at ${MAGENTA}$i${GREEN}...${NORMAL}" FOUND_KNOPPIX="$i" break fi umount /cdrom fi done # Harddisk-installed script part version has been removed # (KNOPPIX can be booted directly from HD now). mount_knoppix() { if test -n "$FOUND_KNOPPIX" -a -r "$1/$KNOPPIX_DIR/$KNOPPIX_NAME"; then # Recheck for modules dir. # If /cdrom/boot/modules is gone, try /cdrom/KNOPPIX/modules # DEBUG # echo "6" > /proc/sys/kernel/printk loadmodule cloop.ko file="$1/$KNOPPIX_DIR/$KNOPPIX_NAME" $CLOOP_PRELOAD || \ loadmodule cloop.ko file="$1/$KNOPPIX_DIR/$KNOPPIX_NAME" mountit /dev/cloop /KNOPPIX "-o ro" || FOUND_KNOPPIX="" # Allow multi-image KNOPPIX mounts if [ -n "$FOUND_KNOPPIX" -a -x "$DYNLOADER" -a -x /KNOPPIX/sbin/losetup ]; then echo "" echo -n "${CRE} ${GREEN}Found primary KNOPPIX compressed image at ${MAGENTA}$1/$KNOPPIX_DIR/$KNOPPIX_NAME${GREEN}.${NORMAL}" for c in 1 2 3 4 5 6 7; do if test -r "$1/$KNOPPIX_DIR/$KNOPPIX_NAME$c"; then if "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/sbin/losetup "/dev/cloop$c" "$1/$KNOPPIX_DIR/$KNOPPIX_NAME$c"; then if "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/bin/mkdir -m 755 -p "/KNOPPIX$c"; then if mountit "/dev/cloop$c" "/KNOPPIX$c" "-o ro"; then echo "" echo -n "${CRE} ${GREEN}Found additional KNOPPIX compressed image at ${MAGENTA}$1/$KNOPPIX_DIR/$KNOPPIX_NAME$c${GREEN}.${NORMAL}" else "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/bin/rmdir "/KNOPPIX$c" 2>/dev/null fi else "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/bin/losetup -d "/dev/cloop$c" 2>/dev/null fi fi fi done /KNOPPIX/bin/ln -snf /KNOPPIX/sbin /sbin && hash -r fi fi } remount_knoppix() { if test -r $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME; then umount /KNOPPIX for c in 0 1 2 3 4 5 6 7; do umount "/$KNOPPIX_NAME$c" >/dev/null 2>&1 done unloadmodule cloop # release CD umount $SOURCE # unmount CD [ -n "$SOURCE2" ] && umount $SOURCE2 # umount possible loop-device mount_knoppix $TARGET else echo "${CRE}${RED}Warning: Changing to $TARGET failed.${NORMAL}" return 1 fi return 0 } boot_from() { # preparations /bin/mkdir $TARGET SOURCE_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/bootfrom=/s/.*=//p' | /usr/bin/tail -1) LOOP_DEV=$(echo $SOURCE_DEV | /usr/bin/gawk -F/ '{ print $1 "/" $2 "/" $3 }') ISO_PATH=$(echo $SOURCE_DEV | /bin/sed "s|$LOOP_DEV||g" ) case "$ISO_PATH" in /*.[iI][sS][oO]) ;; *) ISO_PATH="" ;; esac LOOP_SOURCE="" # load filesystems for i in reiserfs jbd ext3 ntfs fuse; do /KNOPPIX/sbin/modprobe $i >/dev/null 2>&1 done FS="reiserfs ext3 ntfs" if [ -n "$ISO_PATH" ]; then LOOP_SOURCE="$TARGET.loop" LOOP_SOURCE2="$LOOP_SOURCE" TARGET_DEV="$LOOP_SOURCE$ISO_PATH" /bin/mkdir $LOOP_SOURCE /KNOPPIX/sbin/modprobe loop # Try out own mount first. mountit $LOOP_DEV $LOOP_SOURCE "-o ro" if [ "$?" != "0" ]; then for i in $FS; do case "$i" in ntfs) PLAIN="-i" ;; *) PLAIN="" ;; esac /bin/mount $PLAIN -o ro -t $i $LOOP_DEV $LOOP_SOURCE >/dev/null 2>&1 && break done fi test "$?" = "0" || LOOP_SOURCE="" /bin/mount -n -o loop $LOOP_SOURCE2$ISO_PATH $TARGET >/dev/null 2>&1 else TARGET_DEV="$SOURCE_DEV" mountit $SOURCE_DEV $TARGET "-o ro" if [ "$?" != "0" ]; then for i in $FS; do case "$i" in ntfs) PLAIN="-i" ;; *) PLAIN="" ;; esac /bin/mount $PLAIN -n -o ro -t $i $SOURCE_DEV $TARGET >/dev/null 2>&1 done fi fi if [ "$?" != "0" ]; then [ -n "$LOOP_SOURCE" ] && { /bin/umount $LOOP_SOURCE || umount $LOOP_SOURCE; } >/dev/null 2>&1 echo -n "${CRE}${RED}Accessing KNOPPIX ${MEDIUM} failed. ${MAGENTA}$TARGET_DEV${RED} is not mountable.${NORMAL}" sleep 2 return 1 fi if test -r $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME ; then echo -n "${CRE}${GREEN}Accessing KNOPPIX ${MEDIUM} at ${MAGENTA}$TARGET_DEV${GREEN}...${NORMAL}" else echo -n "${CRE}${RED}Accessing KNOPPIX ${MEDIUM} failed. Could not find $KNOPPIX_DIR/$KNOPPIX_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}" [ -n "$LOOP_SOURCE" ] && { /bin/umount -l $LOOP_SOURCE || umount $LOOP_SOURCE; } >/dev/null 2>&1 umount $TARGET sleep 2 return 1 fi # remount the CD remount_knoppix } copy_to() { # preparations /bin/mkdir $TARGET COPY="$SOURCE/$KNOPPIX_DIR" # look if we copy to hd or to ram SIZE="$(/usr/bin/du -s $COPY | /usr/bin/gawk '{print int($1*1.1)}')" test -n "$SIZE" || SIZE="800000" case "$1" in ram) TARGET_DEV="/dev/shm" TARGET_DEV_DESC="ramdisk" FOUNDSPACE="$(/usr/bin/gawk '/MemTotal/{print $2}' /proc/meminfo)" /bin/mount -n -t tmpfs -o size=${SIZE}k $TARGET_DEV $TARGET ;; hd) TARGET_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/tohd=/s/.*=//p' | /usr/bin/tail -1) TARGET_DEV_DESC="$TARGET_DEV" # load filesystems for i in reiserfs jbd ext3 ntfs fuse; do /KNOPPIX/sbin/modprobe $i >/dev/null 2>&1 done FS="ext3 ext2 reiserfs vfat ntfs fuse" /KNOPPIX/bin/cp -au /KNOPPIX/dev/fuse /dev/ >/dev/null 2>&1 MOUNTED="" for filesystem in $FS; do if /KNOPPIX/bin/mount -o rw -t "$filesystem" "$TARGET_DEV" "$TARGET" >/dev/null 2>&1; then MOUNTED="true" break fi done if test -z "$MOUNTED"; then echo -n "${CRE}${RED}Copying KNOPPIX ${MEDIUM} failed. ${MAGENTA}$TARGET_DEV_DESC${RED} is not mountable.${NORMAL}" sleep 2 return 1 fi # check for enough free space USED_SPACE=0 test -r $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME && USED_SPACE=$(/usr/bin/du -s $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME | /usr/bin/gawk '{ print $1 }') FOUNDSPACE="$(/bin/df -k $TARGET | /usr/bin/tail -1 | /usr/bin/gawk '{ print $4+int('$USED_SPACE') }')" ;; *) return 1 ;; esac # sanity check if [ $FOUNDSPACE -lt $SIZE ]; then echo -n "${CRE}${RED}Copying KNOPPIX ${MEDIUM} failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${RED}. Found: ${MAGENTA}${FOUNDSPACE}k${RED} Need: ${MAGENTA}${SIZE}k${RED} ${NORMAL}" sleep 2 umount $TARGET return 1 fi # do the real copy echo "${CRE}${GREEN}Copying KNOPPIX ${MEDIUM} to ${MAGENTA}$TARGET_DEV_DESC${GREEN}... Please be patient. ${NORMAL}" if [ -z "$COPY_COMMAND" -a -x /usr/bin/rsync ]; then # first cp the small files /usr/bin/rsync -a --exclude="$KNOPPIX_DIR/$KNOPPIX_NAME*" $COPY $TARGET # Copy Knoppix to $TARGET # then the big files with nice progress meter /usr/bin/rsync -a --progress --include="$KNOPPIX_DIR/$KNOPPIX_NAME*" --include="$KNOPPIX_DIR/" --exclude="*" $COPY $TARGET else "$COPY_COMMAND" $COPY $TARGET fi if [ "$?" -ne "0" ]; then echo -n "${CRE}${RED}Copying KNOPPIX ${MEDIUM} failed. ${MAGENTA}$TARGET_DEV_DESC${RED} possibly has not enough space left.${NORMAL}" sleep 2 return 1 fi # remount r/o case "$filesystem" in ntfs) umount "$TARGET" ; sleep 2 ; { mountit "$TARGET_DEV" "$TARGET" "-o ro" || /KNOPPIX/bin/mount -i -t ntfs -o ro "$TARGET_DEV" "$TARGET"; } ;; *) /KNOPPIX/bin/mount -n -o remount,ro "$TARGET" ;; esac remount_knoppix } mount_knoppix /cdrom COPYTO="" BOOTFROM="" DO_REMOUNT="" REAL_TARGET="" UNIONFS="" case "$CMDLINE" in *toram*) DO_REMOUNT="yes"; COPYTO="ram"; ;; esac case "$CMDLINE" in *tohd=*) DO_REMOUNT="yes"; COPYTO="hd"; ;; esac case "$CMDLINE" in *bootfrom=*) DO_REMOUNT="yes"; BOOTFROM="yes" ;; esac # Remount later after copying/isoloading/driverloading? # pre-test if everything succeeded if test -n "$DO_REMOUNT" -a -n "$FOUND_KNOPPIX"; then # copy library cache cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache echo "" SOURCE="/cdrom" TARGET="/cdrom2" # first copy_to, then boot_from if [ -n "$COPYTO" ]; then copy_to $COPYTO && REAL_TARGET="$TARGET" fi if [ -n "$BOOTFROM" ]; then boot_from if [ "$?" -eq "0" ]; then # set new source / target paths REAL_TARGET="$TARGET" SOURCE2="$LOOP_SOURCE" SOURCE="/cdrom2" TARGET="/cdrom3" fi fi fi # Final test if everything succeeded. if test -n "$FOUND_KNOPPIX"; then # copy library cache cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache echo "" UNIONFS="" loadmodule aufs.ko 2>/dev/null && UNIONFS="yes" # Enable kernel messages echo "6" > /proc/sys/kernel/printk # Set paths echo -n "${CRE}${BLUE}Setting paths...${NORMAL}" PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:." export PATH # Make space: We don't need the modules anymore from here. /KNOPPIX/bin/rm -rf /modules # Debian weirdness /KNOPPIX/bin/cp -a /KNOPPIX/etc/alternatives /etc/ 2>/dev/null # Replace /sbin /KNOPPIX/bin/rm -f /sbin /KNOPPIX/bin/ln -sf /KNOPPIX/sbin /sbin # From here, we should have all essential commands available. hash -r # Did we remount the source media ? if test -n "$REAL_TARGET"; then /bin/mount -n --move $REAL_TARGET /cdrom # move it back and go on to normal boot fi # Clean up / /KNOPPIX/bin/rm -rf /modules /static # New in Kernel 2.4.x: tmpfs with variable ramdisk size. # We check for available memory anyways and limit the ramdisks # to a reasonable size. # Be verbose # Now we need to use a little intuition for finding a ramdisk size # that keeps us from running out of space, but still doesn't crash the # machine due to lack of Ram # Minimum size of additional ram partitions MINSIZE=20000 # At least this much memory minus 30% should remain when home and var are full. MINLEFT=16000 # Maximum ramdisk size MAXSIZE="$(expr $TOTALMEM - $MINLEFT)" # Default ramdisk size for ramdisk RAMSIZE="$(expr $TOTALMEM / 5)" # Create additional dynamic ramdisk. test -z "$RAMSIZE" -o "$RAMSIZE" -lt "$MINSIZE" && RAMSIZE="$MINSIZE" mkdir -p /ramdisk # tmpfs/varsize version, can use swap RAMSIZE=$(expr $RAMSIZE \* 4) echo -n "${CRE}${BLUE}Creating ${YELLOW}/ramdisk${BLUE} (dynamic size=${RAMSIZE}k) on ${MAGENTA}shared memory${BLUE}...${NORMAL}" # We need /bin/mount here for the -o size= option /bin/mount -t tmpfs -o "size=${RAMSIZE}k,mode=755" /ramdisk /ramdisk mkdir -p /ramdisk/tmp /ramdisk/home/knoppix chmod 1777 /ramdisk/tmp chown knoppix.knoppix /ramdisk/home/knoppix ln -snf /ramdisk/home /home mv /tmp /tmp.old && ln -s /ramdisk/tmp /tmp && rm -rf /tmp.old echo "${BLUE}Done.${NORMAL}" stage=2 rundebugshell echo -n "${CRE}${BLUE}Creating unified filesystem and symlinks on ramdisk...${NORMAL}" mkdir -p /UNIONFS UNION="/ramdisk" # Add all KNOPPIX images to the union for c in "" 1 2 3 4 5 6 7; do [ -d "/KNOPPIX$c" ] && UNION="$UNION:/KNOPPIX$c" done # Do the actual mount if test -n "$UNIONFS" && /bin/mount -t aufs -o "br:$UNION" /UNIONFS /UNIONFS; then # We now have aufs, copy some data from the initial ramdisk first cp -a /etc/fstab /etc/auto.mnt /etc/filesystems /etc/mtab /UNIONFS/etc/ # /dev is a special case, it is now normally handled via udev UNIONDEV="" case "$CMDLINE" in *noudev*) UNIONDEV="dev"; ;; esac for i in bin boot etc $UNIONDEV sbin var lib opt root usr; do # Move directories to union if test -d /$i; then mv /$i /$i.old && \ /KNOPPIX/lib/ld-linux.so.2 --library-path /KNOPPIX/lib /KNOPPIX/bin/ln -snf /UNIONFS/$i /$i && \ rm -rf /$i.old else ln -snf /UNIONFS/$i /$i fi done for i in $(cd /UNIONFS; echo *); do # Create links for new stuff on /UNIONFS test "$i" = "home" -o "$i" = "tmp" && continue test -L "/$i" || test -d "/$i" || test -f "/$i" || ln -snf "/UNIONFS/$i" /$i done else echo -n "${CRE}${RED}ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!${NORMAL}" /KNOPPIX/sbin/halt -f -n fi echo "" echo "${GREEN}>> Read-only ${MEDIUM} system successfully merged with read-write /ramdisk.${NORMAL}" chown knoppix.knoppix /home/knoppix # CUPS wants writable files. :-/ cp -a /KNOPPIX/etc/cups/*.conf /etc/cups/ 2>/dev/null # resolv.conf must be writable as well cp -a /KNOPPIX/etc/dhcpc/resolv.conf /etc/dhcpc/ 2>/dev/null # Create empty utmp and wtmp :> /var/run/utmp :> /var/run/wtmp # Make SURE that these are files, not links! rm -rf /etc/ftpusers /etc/passwd /etc/shadow /etc/gshadow /etc/group \ /etc/ppp /etc/isdn /etc/ssh /etc/ioctl.save \ /etc/inittab /etc/network /etc/sudoers \ /etc/init /etc/localtime /etc/dhcpc /etc/pnm2ppa.conf 2>/dev/null cp -a /KNOPPIX/etc/ftpusers /KNOPPIX/etc/passwd /KNOPPIX/etc/shadow /etc/gshadow /KNOPPIX/etc/group \ /KNOPPIX/etc/ppp /KNOPPIX/etc/isdn /KNOPPIX/etc/ssh \ /KNOPPIX/etc/inittab /KNOPPIX/etc/network /KNOPPIX/etc/sudoers \ /KNOPPIX/sbin/init /KNOPPIX/etc/dhcpc /etc/ 2>/dev/null # Extremely important, init crashes on shutdown if this is only a link :> /etc/ioctl.save :> /etc/pnm2ppa.conf # Must exist for samba to work [ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb # Kernel 2.6.9 bug? chmod 1777 /tmp /var/tmp # Diet libc bug workaround /bin/cp -f /KNOPPIX/etc/localtime /etc/localtime echo "${BLUE}Done.${NORMAL}" # Mount devpts, should be done much later # mount -t devpts /dev/pts /dev/pts 2>/dev/null # Clean up /etc/mtab (and - just in case - make a nice entry for looped ISO) /bin/egrep " /KNOPPIX[0-9]* | /cdrom " /proc/mounts | sed 's|/dev/loop0 /cdrom \(.*\) 0 0|'$LOOP_SOURCE$ISO_PATH' /cdrom/ \1,loop=/dev/loop0 0 0|g' >> /etc/mtab # Now tell kernel where the real modprobe lives echo "/sbin/modprobe" > /proc/sys/kernel/modprobe # Change root device from /dev/fd0 to /dev/ram0 echo "0x100" > /proc/sys/kernel/real-root-dev stage=3 rundebugshell # Give control to the init process. echo "${CRE}${BLUE}Starting init process.${NORMAL}" rm -f /linuxrc exit 0 else echo "${CRE}${RED}Can't find KNOPPIX filesystem, sorry.${NORMAL}" echo "${RED}Dropping you to a (very limited) shell.${NORMAL}" echo "${RED}Press reset button to quit.${NORMAL}" echo "" echo "Additional builtin commands avaliable:" echo " cat mount umount" echo " insmod rmmod lsmod" echo "" PS1="knoppix# " export PS1 echo "6" > /proc/sys/kernel/printk # Allow signals trap 1 2 3 11 15 exec /static/ash fi
true
4344549d5f5e6801e64bfb45df11d4c68259e48f
Shell
torben-fruechtenicht/rawtherapee
/test/run.sh
UTF-8
743
3.671875
4
[]
no_license
#! /usr/bin/env bash declare -r TESTS_ROOT=$(dirname "$(readlink "$0")") export VERBOSE= find "$TESTS_ROOT" -type f -name 'test*.sh' | sort | while read -r test_cmd; do echo echo "=========================================================" echo "Running $test_cmd" echo "=========================================================" "$test_cmd" echo "-----" if (( $? == 0 )); then echo "[SUCCESS] All tests from $(dirname "$test_cmd") passed" else echo "[FAIL] There were failures in $(dirname "$test_cmd")" declare failures_exist= fi done echo -e "\n=====" if [[ -v failures_exist ]]; then echo "[FAIL] There were failed tests" else echo "[SUCCESS] All tests passed" fi
true
a340e7054041f39cfd51fe5abb52babe76677c96
Shell
tarmiste/lfspkg
/archcore/svnsnap/community/trickle/trunk/PKGBUILD
UTF-8
1,011
2.609375
3
[]
no_license
# $Id: PKGBUILD 266875 2017-11-15 14:29:11Z foutrelis $ # Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org> # Contributor Romain Bouchaud-Leduc <r0m1.bl@camaris.org> pkgname=trickle pkgver=1.07 pkgrel=9 pkgdesc="Lightweight userspace bandwidth shaper" arch=('x86_64') url="http://monkey.org/~marius/trickle" license=('BSD') depends=('libevent') source=("http://monkey.org/~marius/trickle/${pkgname}-${pkgver}.tar.gz" "fix-crasher.patch") md5sums=('860ebc4abbbd82957c20a28bd9390d7d' 'a072091bce131e9f7229bff85ed5858c') prepare() { cd "${srcdir}/${pkgname}-${pkgver}" # FS#27549 sed -i 's|^_select(int|select(int|' trickle-overload.c # FS#35872 patch -Np1 -i "${srcdir}/fix-crasher.patch" } build() { cd "${srcdir}/${pkgname}-${pkgver}" ./configure --prefix=/usr \ --mandir=/usr/share/man sed -i "s|.*in_addr_t.*||g" config.h make -j1 } package(){ cd "${srcdir}/${pkgname}-${pkgver}" make DESTDIR="${pkgdir}" install install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" }
true
88dcb5ceb9941eda739589dfae250f0dedaaa6ac
Shell
GeoscienceAustralia/SWHAQ
/scripts/run_apply_wind_multipliers.sh
UTF-8
1,864
2.953125
3
[]
no_license
#!/bin/bash #PBS -P w85 #PBS -q normal #PBS -N wm_max_aep #PBS -m abe #PBS -M craig.arthur@ga.gov.au #PBS -l walltime=2:00:00 #PBS -l mem=100GB,ncpus=4,jobfs=4000MB #PBS -W umask=0002 #PBS -joe #PBS -l storage=gdata/hh5+gdata/w85 SOFTWARE=/g/data/w85/software # Add PyKrige and TCRM code to the path: export PYTHONPATH=$PYTHONPATH:$SOFTWARE/tcrm/master module purge module use /g/data/hh5/public/modules module load conda/analysis3 #cd $HOME/SWHAQ/scripts cd /g/data/w85/QFES_SWHA/scripts python3 ari_interpolate.py python3 apply_wind_multipliers.py # Short shell script to clip the spatial extent of local scale wind hazard grids # to a smaller extent. Initial steps of processing covered all of Queensland, # but to ensure efficient processing of subsequent steps we clip to a smaller # region over southeast Queensland. # # This requires the following steps: # - Clipping the data to the predetermined extent # - Modifying the `GeoTransfom`` attribute of the `spatial_ref` variable to # update the coords of the reference grid point (upper left corner grid # cell) # - Replacing erroneus values with the correct missing value # - Redefining the `standard_name` attribute of the dimension coordinates, # which is mangled by the preceding CDO command. module load nco module load cdo cd /g/data/w85/QFES_SWHA/hazard/output/wm_combined_aep_pp for FILE in windspeed_*_yr.nc; do OUTFILE=${FILE//.nc/_clip.nc} echo $OUTFILE ncks -O -d longitude,151.,154. -d latitude,-30.,-24. $FILE tmp.nc ncatted -a GeoTransform,spatial_ref,m,c,"151.000138888696 0.0002777777779999919 0.0 -24.000138888696 0.0 -0.0002777777779999991" tmp.nc cdo -O -L -s -setrtomiss,-999999.,0. -setmissval,-9999. tmp.nc $OUTFILE ncatted -a standard_name,latitude,m,c,"latitude" -a standard_name,longitude,m,c,"longitude" $OUTFILE done #python3 visualise_aep_windspeed.py
true
0aa6655394e0b6c22cb0b4ae763b8793122517c9
Shell
kisslinux/kiss
/contrib/kiss-size
UTF-8
1,302
4.4375
4
[ "MIT" ]
permissive
#!/bin/sh -ef # Show the size on disk for a package get_size() { # Naive function to convert bytes to human readable # sizes (MB, KB, etc). This is probably wrong in places # though we can fix this over time. It's a start. case ${#1} in [0-3]) hum=$(($1))KB ;; [4-6]) hum=$(($1 / 1024))MB ;; [7-9]) hum=$(($1 / 1024 / 1024))GB ;; *) hum=$(($1)) ;; esac printf '%s\t%s\n' "$hum" "$2" } # Use the current directory as the package name if no package is given. [ "$1" ] || set -- "${PWD##*/}" # Ignore shellcheck as we want the warning's behavior. # shellcheck disable=2015 kiss list "${1:-null}" >/dev/null || { printf 'usage: kiss-size [pkg]\n' exit 1 } # Filter directories from manifest and leave only files. # Directories in the manifest end in a trailing '/'. # Send the file list to 'xargs' to run through 'du', # this prevents du from exiting due to too many arguments sed -e "s|^|$KISS_ROOT|" -e 's|.*/$||' \ "$KISS_ROOT/var/db/kiss/installed/$1/manifest" \ | xargs du -sk -- 2>/dev/null | # Iterate over each line and convert the byte output to human # readable (MB, KB, GB, etc). while read -r size file || { get_size "$tot" total >&2 break } do get_size "$size" "$file" tot=$((tot + size)) done
true
c7693a52dad74deebc7ab333e2c7ab49cdb092bb
Shell
tjdokas/scripts
/makekey.sh
UTF-8
770
2.765625
3
[]
no_license
#!/bin/bash echo 'this will produce a .ppk key' mkdir /home/$USER/.ssh chmod $USER /home/$USER/.ssh cd ~/.ssh ssh-keygen -t rsa puttygen id_rsa -o id_rsa.ppk echo "a new key for user ${USER} has been produced in the ~/.ssh directory" string="$(cat id_rsa.pub)" sudo echo $string >> authorized_keys sudo apt-get install libpam-google-authenticator cd ~ #sudo echo 'auth required pam_google_authenticator.so' >> /etc/pam.d/sshd sudo systemctl restart sshd.service #sudo sed 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config google-authenticator #chmod $USER /etc/ssh/sshd_config #sudo echo 'Match Group dokas' >> /etc/ssh/sshd_config #sudo echo ' AuthenticationMethods publickey,keyboard-interactive' >> /etc/ssh/sshd_config
true
4a1ea2c74dac7258c59d410b1b28d5e25bb3aa88
Shell
ginowu7/CustomSimulatorsExample
/launch_multiple_simulators.sh
UTF-8
439
3.078125
3
[]
no_license
#!/bin/bash xcrun simctl shutdown all path=$(find ~/Library/Developer/Xcode/DerivedData/CustomSimulatorsExample-*/Build/Products/Debug-iphonesimulator -name "CustomSimulatorsExample.app" | head -n 1) echo "${path}" filename=MultiSimConfig.txt grep -v '^#' $filename | while read -r line do echo $line xcrun instruments -w "$line" xcrun simctl install booted $path xcrun simctl launch booted example.CustomSimulatorsExample done
true
07faa5461b877250f63a53b8e09a3bdcf0ce1fa5
Shell
exescribis/ScribesInfra
/scribesclasses/res/commands/eval-modelioscript.sh
UTF-8
1,172
3.640625
4
[]
no_license
#!/usr/bin/env bash # This is a template so braces are like this {{ }} #--- parameter handling ----------------------------------------------- CASE=$1 flatfilename() {{ # }} because of template echo $1 | sed 's|/|_|g' }} # }} because of template # search the soils.txt file FILELIST={hq_root_repo_dir}/$CASE/files.txt if [ ! -f $FILELIST ] ; then echo "File not found: $FILELIST" > /dev/stderr exit 2 fi #--- output ----------------------------------------------------------- OUTDIR={hq_root_repo_dir}/$CASE/.build/{key} SUMMARY=$OUTDIR/summary.csv rm -rf $OUTDIR mkdir -p $OUTDIR # echo # echo # echo "=== {key} ====================================================" cd "{local_group_repo_dir}" cd $CASE echo -n '"G{key}",' for LINE in `cat $FILELIST | tr ' ' '|'` do read FILENAME TITLE <<< $( echo $LINE | tr '|' ' ' ) echo -n '"'$TITLE'",' if [ -f $FILENAME ] ; then infile=$OUTDIR/$TITLE.py outfile=$OUTDIR/$TITLE.out errfile=$OUTDIR/$TITLE.err cat $FILENAME > $infile echo -n `cat $infile | wc -l`',"NCLOC",' else echo -n '"NOT FOUND",-999,-999,' fi echo '"."' done
true
4305450db365c6a02aff8f4579cd631700d9a87a
Shell
LesyaMazurevich/slackbuilds
/fdutils/apply-patches.sh
UTF-8
929
2.671875
3
[]
no_license
set -e -o pipefail SB_PATCHDIR=${CWD}/patches # patch -p0 -E --backup --verbose -i ${SB_PATCHDIR}/${NAME}.patch tar xvf ${CWD}/${PDSRCARCHIVE} zcat ${CWD}/${PSRCARCHIVE} | patch -p1 -E --backup --verbose ### Debian for patch in \ makefile-destdir.patch \ mediaprm-fix_etc-fdprm.patch \ floppymeter-confirmation_message.patch \ MAKEFLOPPIES-chown_separator.patch \ MAKEFLOPPIES-xsiisms.patch \ MAKEFLOPPIES-devfs.patch \ MAKEFLOPPIES-usage.patch \ superformat-devfs_floppy.patch \ superformat-env_variables.patch \ superformat-verify_later.patch \ fdmount-compilation_linux_2.6.patch \ dont_strip_binaries.patch \ help_messages.patch \ remove_texi2html_dependency.patch \ floppymeter-makefile_typo.patch \ documentation-faq_cleanup.patch \ ; do patch -p1 -E --backup --verbose -z .pdeb -i debian/patches/${patch} done # Set to YES if autogen is needed SB_AUTOGEN=YES set +e +o pipefail
true
0986fa43550f6eb7fd53a8c63ee5ea062f893371
Shell
whitby/mac-scripts
/puppetrepo/preinstall
UTF-8
194
2.8125
3
[]
no_license
#!/bin/bash ENVDIR="/etc/puppet/environments" HIERADIR="/etc/puppet/hieradata" if [ -d "$ENVDIR" ]; then /bin/rm -rf $ENVDIR fi if [ -d "$HIERADIR" ]; then /bin/rm -rf $HIERADIR fi exit 0
true
604f40ad4f974f79771b5d47565a86867a87ab1b
Shell
verdammelt/dotfiles
/Bin/run-test-runner
UTF-8
571
3.34375
3
[]
no_license
#!/usr/bin/env bash if [ -d .exercism ]; then track=$(basename $(realpath "${PWD}/../")) elif [ -d .meta ]; then track=$(basename $(realpath "${PWD}/../../../")) else echo "Unknown directory structure" exit 1 fi exercise=$(basename "$PWD") test_runner="exercism/${track}-test-runner" docker pull "${test_runner}" docker run \ --network none \ --read-only \ --mount type=bind,src="${PWD}",dst=/solution \ --mount type=bind,src="${PWD}",dst=/output \ --mount type=tmpfs,dst=/tmp \ "${test_runner}" "${exercise}" /solution /output
true
3c0b4f9af11f81bfeb02221d23a22e5c21684107
Shell
warnerAWESOMEmoore/dbdeployer
/dbtype/postgres/create_database.sh
UTF-8
336
3.71875
4
[ "MIT" ]
permissive
#!/usr/bin/env bash function create_database() { _createdb="${1}" ${db_binary} ${server_flag} ${user_flag} ${port_flag} ${encryption_flag} -d postgres -c "create database \"${_createdb}\";" rc=$? unset _createdb if [ ${rc} -eq 0 ] then return 0 else echo "Error creating the database, exiting" return 1 fi }
true
2422c87b1d3bf27560d5f59fd63479afef918c65
Shell
openmhealth/shimmer
/run-dockerized.sh
UTF-8
1,808
4.0625
4
[ "Apache-2.0" ]
permissive
#!/bin/bash BASEDIR=`pwd` isNpmPackageInstalled() { npm list --depth 1 -g $1 > /dev/null 2>&1 } # check dependencies if ! hash "npm" 2>/dev/null; then echo "npm can't be found" exit 1 fi if ! hash "docker-compose" 2>/dev/null; then echo "docker-compose can't be found" exit 1 fi # remove the symlink which may have been created by running natively earlier rm -f ${BASEDIR}/shim-server/src/main/resources/public #CMD # build the console echo -n "Do you want to rebuild the console (y/N)? " read answer if echo "$answer" | grep -iq "^y" ;then cd ${BASEDIR}/shim-server-ui #CMD if ! isNpmPackageInstalled grunt-cli then echo Installing Grunt. You may be asked for your password to run sudo... sudo npm install -g grunt-cli #CMD else echo Grunt is already installed, skipping... fi if ! isNpmPackageInstalled bower then echo Installing Bower. You may be asked for your password to run sudo... sudo npm install -g bower #CMD else echo Bower is already installed, skipping... fi echo Installing npm dependencies... npm install #CMD echo Installing Bower dependencies... bower install #CMD echo Building the console... grunt build #CMD fi # build the backend echo -n "Do you want to rebuild the resource server (y/N)? " read answer if echo "$answer" | grep -iq "^y" ;then echo Building the resource server... cd ${BASEDIR} #CMD ./gradlew build #CMD fi # run the containers cd ${BASEDIR} #CMD echo Building the containers... docker-compose -f docker-compose-build.yml build #CMD echo Starting the containers in the background... docker-compose -f docker-compose-build.yml up -d #CMD echo Done, containers are starting up and may take up to a minute to be ready.
true
a800ceaa79fe2d623f61da4efcbc4b3489227f82
Shell
capslocky/git-rebase-via-merge
/git-rebase-via-merge.sh
UTF-8
5,559
4.125
4
[ "MIT" ]
permissive
#!/usr/bin/env bash # # The latest version of this script is here # https://github.com/capslocky/git-rebase-via-merge # # Copyright (c) 2022 Baur Atanov # default_base_branch="origin/develop" base_branch=${1:-$default_base_branch} set -e main() { echo "This script will perform rebase via merge." echo init git checkout --quiet "$current_branch_hash" # switching to detached head state (no current branch) git merge "$base_branch" -m "Hidden orphaned commit to save merge result." || true echo if merge_conflicts_present; then echo "You have at least one merge conflict." echo fix_merge_conflicts fi hidden_result_hash=$(get_hash HEAD) echo "Merge succeeded at hidden commit:" echo "$hidden_result_hash" echo echo "Starting rebase resolving any conflicts automatically." git checkout --quiet "$current_branch" git rebase "$base_branch" -X theirs || true if rebase_conflicts_present; then echo "You have at least one rebase conflict." echo fix_rebase_conflicts fi current_tree=$(git cat-file -p HEAD | grep tree) result_tree=$(git cat-file -p "$hidden_result_hash" | grep tree) if [ "$current_tree" != "$result_tree" ]; then echo "Restoring project state from the hidden merge with single additional commit." echo additional_commit_message="Rebase via merge. '$current_branch' rebased on '$base_branch'." additional_commit_hash=$(git commit-tree $hidden_result_hash^{tree} -p HEAD -m "$additional_commit_message") git merge --ff "$additional_commit_hash" echo else echo "You don't need additional commit. Project state is correct." fi echo "Done." exit 0 } init() { current_branch=$(git symbolic-ref --short HEAD) if [ -z "$current_branch" ]; then echo "Can't rebase. There is no current branch: you are in detached head." exit 1 fi base_branch_hash=$(get_hash "$base_branch") current_branch_hash=$(get_hash "$current_branch") if [ -z "$base_branch_hash" ]; then echo "Can't rebase. Base branch '$base_branch' not found." exit 1 fi echo "Current branch:" echo "$current_branch ($current_branch_hash)" show_commit "$current_branch_hash" echo echo "Base branch:" echo "$base_branch ($base_branch_hash)" show_commit "$base_branch_hash" echo if [ -n "$(get_any_changed_files)" ]; then echo "Can't rebase. You need to commit changes in the following files:" echo get_any_changed_files exit 1 fi if [ "$base_branch_hash" = "$current_branch_hash" ]; then echo "Can't rebase. Current branch is equal to the base branch." exit 1 fi if [ -z "$(git rev-list "$base_branch" ^"$current_branch")" ]; then echo "Can't rebase. Current branch is already rebased." exit 1 fi if [ -z "$(git rev-list ^"$base_branch" "$current_branch")" ]; then echo "Can't rebase. Current branch has no any unique commits. You can do fast-forward merge." exit 1 fi while true; do echo "Continue (c) / Abort (a)" read input echo if [ "$input" = "c" ]; then break elif [ "$input" = "a" ]; then echo "Aborted." exit 1 else echo "Invalid option." echo "Type key 'c' - to Continue or 'a' - to Abort." echo fi done } get_any_changed_files() { git status --porcelain --ignore-submodules=dirty | cut -c4- } get_unstaged_files() { git status --porcelain --ignore-submodules=dirty | grep -v "^. " | cut -c4- } get_files_with_conflict_markers() { git diff --check | cat } merge_conflicts_present() { file_merge="$(git rev-parse --show-toplevel)/.git/MERGE_HEAD" [ -e "$file_merge" ] } rebase_conflicts_present() { [[ $(git diff --name-only --diff-filter=U --relative) ]] } get_hash() { git rev-parse --short "$1" || true } show_commit() { git log -n 1 --pretty=format:"%<(20)%an | %<(14)%ar | %s" "$1" } fix_merge_conflicts() { while true; do echo "Fix all conflicts in the following files, stage all the changes and type 'c':" get_unstaged_files echo echo "List of conflict markers:" get_files_with_conflict_markers echo echo "Continue (c) / Abort (a)" read input echo if [ "$input" = "c" ]; then if [ -z "$(get_unstaged_files)" ]; then git commit -m "Hidden orphaned commit to save merge result." break else echo "There are still unstaged files." get_unstaged_files echo fi elif [ "$input" = "a" ]; then echo "Aborting merge." git merge --abort git checkout "$current_branch" echo "Aborted." exit 2 else echo "Invalid option." echo "Type key 'c' - to Continue or 'a' - to Abort." echo fi done } fix_rebase_conflicts() { while true; do echo "Fix all conflicts in the following files, stage all the changes and type 'c':" get_unstaged_files echo echo "List of conflict markers:" get_files_with_conflict_markers echo echo "Continue (c) / Abort (a)" read input echo if [ "$input" = "c" ]; then if [ -z "$(get_unstaged_files)" ]; then git rebase --continue break else echo "There are still unstaged files." get_unstaged_files echo fi elif [ "$input" = "a" ]; then echo "Aborting rebase." git rebase --abort git checkout "$current_branch" echo "Aborted." exit 2 else echo "Invalid option." echo "Type key 'c' - to Continue or 'a' - to Abort." echo fi done } main
true
af33e38e1c3664eba65a584fcb67a4534f016aaa
Shell
SFSLiveBoot/50-postgres-sfs
/opt/bin/postgresql-init.sh
UTF-8
977
3.171875
3
[]
no_license
#!/bin/sh : "${svc_d:=/etc/systemd/system/postgresql.service.d}" : "${db_d:=/srv/db}" set -e -x mkdir -p "$svc_d" test "$(sysctl -n kernel.shmmax)" -ge 268435456 || sysctl kernel.shmmax=268435456 || true test -e "$db_d" || install -d -o 1000 "$db_d" test -e "$db_d/PG_VERSION" || sudo $(stat -L -c "-u#%u -g#%g" "$db_d") env LANG=C.UTF-8 $(find /opt/postgres/lib/postgresql -path "*/bin/initdb" | sort -nr | head -1) "$db_d" PG_VERSION=$(cat "$db_d/PG_VERSION") ldconfig -p | grep -q /opt/postgres/lib || ldconfig cat >"$svc_d/exec.conf" <<EOF [Service] Environment="PATH=/opt/postgres/lib/postgresql/$PG_VERSION/bin:$PATH" User=$(stat -c %U "$db_d") Group=$(stat -c %G "$db_d") ExecStart=/opt/postgres/lib/postgresql/$PG_VERSION/bin/pg_ctl start -l '$db_d/postgres.log' -w -D '$db_d' ExecStop=/opt/postgres/lib/postgresql/$PG_VERSION/bin/pg_ctl stop -D '$db_d' ExecReload=/opt/postgres/lib/postgresql/$PG_VERSION/bin/pg_ctl reload -D '$db_d' EOF systemctl daemon-reload
true
b8185e8054eb95a4847d2ddc225510e119d58f56
Shell
RoninHsu/fbt-scripts
/normalize_expinfo/clean_year.sh
UTF-8
263
2.75
3
[]
no_license
#!/usr/bin/env bash awk ' BEGIN{ FS=OFS="\t"; } { id=$1; year=$2; match(year"", /[12][0-9][0-9][0-9]/); if(RSTART) { print id, substr(year, RSTART, 4); } else { print id, "null"; } } ' year.txt > year.txt.cleaned
true
6535e9432d030fec368dc17b2a0ecc0cfa485dda
Shell
rLinks234/Android-Misc-Binutils
/exec/lnx/lbuild
UTF-8
616
3.375
3
[]
no_license
#!/bin/sh HERE=`dirname $0` OUTPUT_DIR=`readlink -f $HERE/out` SRC_ROOT=`readlink -f $HERE/../src` INC_ROOT=`readlink -f $HERE/../include` if [ ! -d "$OUTPUT_DIR" ]; then mkdir "$OUTPUT_DIR" fi BOOST_LOC=`strings -n5 /etc/ld.so.cache | grep -E "\/.+libboost_program_options\.so" -m 1` LD_ADD_DIR=`dirname $BOOST_LOC` G_O_ARGS="-g -Os -std=c++11 -frtti -fexceptions -I$INC_ROOT -I$SRC_ROOT -pthread" G_L_ARGS="-L$BOOST_LOC -lboost_program_options -lfreetype -pthread" compile_files='bmfinfo bmfwriter' cd $SRC_ROOT/bmf for f in $compile_files do g++ $G_O_ARGS $f.cpp -o $OUTPUT_DIR/$f $G_L_ARGS done cd $HERE
true
a974fd18a2038f8ac5fa795095d219313d913aaa
Shell
jwerak/ansible-service-broker
/scripts/kubernetes/deploy.sh
UTF-8
539
2.96875
3
[ "Apache-2.0" ]
permissive
#!/bin/bash source "$(dirname "${BASH_SOURCE}")/../lib/init.sh" PROJECT=${ASB_PROJECT} kubectl delete ns ${PROJECT} retries=25 for r in $(seq $retries); do kubectl get ns ansible-service-broker | grep ansible-service-broker if [ "$?" -eq 1 ]; then break fi sleep 4 done kubectl delete clusterrolebindings --ignore-not-found=true asb kubectl delete pv --ignore-not-found=true etcd # Render the Kubernetes template "${TEMPLATE_DIR}/k8s-template.py" kubectl create -f "${TEMPLATE_DIR}/k8s-ansible-service-broker.yaml"
true
acd1a23948afc2fe868c0f2506540a3e5e175ffc
Shell
dheurlin/wm_dotfiles
/config/bspwm/scripts/bar_padding.sh
UTF-8
953
4.125
4
[]
no_license
#! /bin/bash ###################################### # Sets the top padding on each monitor # to compensate for the height of the # status bar ###################################### set_all_padding() { # Find each polybar instance and figure out its height and what monitor it's on xdotool search --classname polybar | while read -r bar_id; do info=`xwininfo -id $bar_id` monitor=`echo "$info" | grep xwininfo | awk '{print $5}' | sed 's/.*_\(.*\)"/\1/g'` height=` echo "$info" | grep Height | awk '{print $2}'` set_padding_for_monitor $monitor $height done } set_padding_for_monitor() { # Adjusts the padding for a given monitor for a bar of the given height. # NOTE: This assumes that we want the top padding as bottom padding monitor=$1 height=$2 let totalheight=`bspc config -m $monitor bottom_padding`+$height bspc config -m $monitor top_padding $totalheight } while true; do set_all_padding sleep 5 done
true
54807854c352e107533af182f49d57cc2644ae6a
Shell
thatderek/helpful
/python-dev.sh
UTF-8
451
3.421875
3
[]
no_license
#!/bin/bash # # Writing something in Lambda? # Use this script to monitor for saves # and then run your code in a clone of the lambda env. # filename='prx_create.py' OG_VALUE=`openssl md5 $filename` echo "og value is $OG_VALUE" while : do sleep 1 TEMP_VALUE=`openssl md5 $filename` if [ "$TEMP_VALUE" != "$OG_VALUE" ] then echo "temp value, $TEMP_VALUE, $OG_VALUE" OG_VALUE=`openssl md5 $filename` python $filename fi done
true
2e2e7cb2c5bdc39cb754acf0700def481a608304
Shell
langenhagen/scripts
/get-deeper-commit.sh
UTF-8
407
3.734375
4
[]
no_license
#!/bin/bash # From 2 given commits, print the commit that is deeper in the ancestry line. # # Usage: # # get-deeper-commit.sh aaaaaa bbbbbb # prints `aaaaaa``, assuming aaaaaa is the older commit # get-deeper-commit.sh HEAD~4 HEAD~5 # prints `HEAD~5` # # author: andreasl ancestry_path="$(git rev-list --ancestry-path "${1}..${2}")" || exit [ -n "$ancestry_path" ] && echo "$1" || echo "$2"
true
d902b0e7a0a71933f08e7373bbe2e6483fb92205
Shell
jaklinger/setupscripts
/install_basemap.sh
UTF-8
810
3.234375
3
[ "Apache-2.0" ]
permissive
#!bin/bash PROJ4=proj-4.9.3 BASEMAP=1.1.0 VERYTMPDIR=basemap_downloads VERYTOPDIR=$PWD GEOS_DIR=/usr/local/ PROJ_DIR=/usr/local/ # Install and set to GCC instead of clang brew install gcc export CC=gcc-7 # Enter tmp directory mkdir $VERYTMPDIR cd $VERYTMPDIR # Get Proj4j wget http://download.osgeo.org/proj/${PROJ4}.tar.gz tar -xvf ${PROJ4}.tar.gz cd ${PROJ4} mkdir $VERYTMPDIR # Bizarre bug fix ./configure --prefix=$PROJ_DIR make make install # Get basemap cd ../ wget https://github.com/matplotlib/basemap/archive/v${BASEMAP}.tar.gz tar -xvf v${BASEMAP}.tar.gz cd basemap-${BASEMAP} # Install GEOS cd geos-3.3.3 ./configure --prefix=$GEOS_DIR make make install # Install BaseMap cd ../ python setup.py install # Back to the top cd $VERYTOPDIR rm -r $VERYTMPDIR # Install pyproj pip install pyproj
true
a9e7987fa8de2fcf73cb998b7c42b59bb089cd66
Shell
hotsub/lab
/projects/BWA-measurement/benchmark.sh
UTF-8
943
3.703125
4
[]
no_license
#!/bin/bash # Let it fail if undefined variable is referenced. set -u if [ "$#" -lt 2 ]; then echo "Too few arguments for this script: expected 2, but $#" printf "Example:\n\n\t./driver.sh m4.16xlarge 256\n\n" exit 1 fi # Current File Directory CFD=$(cd $(dirname $0) && pwd) SHARED_SPEC=$1 SAMPLE_COUNT=$2 # Please remain log files EVEN IF hotsub command failed!! set +e set -v ### Show what command is really issued ### hotsub \ --script ${CFD}/bwa-mem.sh \ --tasks ${CFD}/tasks/bwa-mem.${SAMPLE_COUNT}.csv \ --image otiai10/bwa \ --concurrency 64 \ --shared REFERENCE=s3://hotsub/resources/reference/GRCh37 \ --env REFFILE=GRCh37.fa \ --env CASE=${SHARED_SPEC}-x`printf %03d ${SAMPLE_COUNT}` \ --aws-ec2-instance-type m4.large \ --aws-shared-instance-type ${SHARED_SPEC} \ --verbose \ 1>${CFD}/stdout.log 2>${CFD}/stderr.log ; echo $? >${CFD}/exitcode.log echo "DONE: `date`"
true
894d716d27fa59d828481a30cd4ce0ef56f1cec9
Shell
HPCToolkit/hpctoolkit-tutorial-examples
/examples/gpu/laghos/setup-env/crusher.sh
UTF-8
2,403
2.765625
3
[]
no_license
export HPCTOOLKIT_TUTORIAL_RESERVATION=default if [ -z "$HPCTOOLKIT_TUTORIAL_PROJECTID" ] then echo "Please set environment variable HPCTOOLKIT_TUTORIAL_PROJECTID to your project id" echo " 'default' to run with your default project id unset" elif [ -z "$HPCTOOLKIT_TUTORIAL_RESERVATION" ] then echo "Please set environment variable HPCTOOLKIT_TUTORIAL_RESERVATION to an appropriate value:" # echo " 'hpctoolkit1' for day 1" # echo " 'hpctoolkit2' for day 2" echo " 'default' to run without the reservation" else if test "$HPCTOOLKIT_TUTORIAL_PROJECTID" != "default" then export HPCTOOLKIT_PROJECTID="-A ${HPCTOOLKIT_TUTORIAL_PROJECTID}_crusher" else unset HPCTOOLKIT_PROJECTID fi if test "$HPCTOOLKIT_TUTORIAL_RESERVATION" != "default" then export HPCTOOLKIT_RESERVATION="--reservation=$HPCTOOLKIT_TUTORIAL_RESERVATION" else unset HPCTOOLKIT_RESERVATION fi # cleanse environment module purge # load modules needed to build and run laghos module load PrgEnv-amd amd/5.4.3 cray-mpich craype-x86-trento craype-accel-amd-gfx90a # modules for hpctoolkit # module use /gpfs/alpine/csc322/world-shared/modulefiles/x86_64 # export HPCTOOLKIT_MODULES_HPCTOOLKIT="module load hpctoolkit/default" export HPCTOOLKIT_MODULES_HPCTOOLKIT="module load hpctoolkit/develop" $HPCTOOLKIT_MODULES_HPCTOOLKIT # environment settings for this example export HPCTOOLKIT_GPU_PLATFORM=amd export HPCTOOLKIT_HIP_ARCH=gfx90a export HPCTOOLKIT_MPI_CC=cc export HPCTOOLKIT_MPI_CXX=CC export HPCTOOLKIT_LAGHOS_ROOT="$(pwd)" export HPCTOOLKIT_LAGHOS_MODULES_BUILD="" export HPCTOOLKIT_LAGHOS_C_COMPILER=amdclang export HPCTOOLKIT_LAGHOS_MFEM_FLAGS="phip HIP_ARCH=$HPCTOOLKIT_HIP_ARCH BASE_FLAGS='-std=c++11 -g'" export HPCTOOLKIT_LAGHOS_SUBMIT="sbatch $HPCTOOLKIT_PROJECTID -t 5 -N 1 $HPCTOOLKIT_RESERVATION" export HPCTOOLKIT_LAGHOS_RUN_SHORT="$HPCTOOLKIT_LAGHOS_SUBMIT -J laghos-run-short -o log.run-short.out -e log.run-short.error" export HPCTOOLKIT_LAGHOS_RUN_LONG="$HPCTOOLKIT_LAGHOS_SUBMIT -J laghos-run-long -o log.run-long.out -e log.run-long.error" export HPCTOOLKIT_LAGHOS_RUN_PC="sh make-scripts/unsupported-amd.sh" export HPCTOOLKIT_LAGHOS_BUILD="sh" export HPCTOOLKIT_LAGHOS_LAUNCH="srun -n 8 -c 1 --gpus-per-node=8 --gpu-bind=closest" # mark configuration for this example export HPCTOOLKIT_EXAMPLE=laghos fi
true
4d245790b4261dafbc4a0edc66b148e29e1d2e15
Shell
wyattscarpenter/util
/tts-file
UTF-8
979
3.71875
4
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
#!/bin/bash # this script allows you to call mozilla's tts on a file or files as arguments (it does not accept any other option arguments) # this is basically a hack to deal with the fact that they don't currently accept files as input (and also that command line arguments can only be a certain length, so we break on linebreaks) # pip install TTS for file in "$@"; do mkdir "tmp.tts.$file" cd "tmp.tts.$file" index=0 while read l || [[ -n "$l" ]]; do # the bit after the || catches the last line if it isn't followed by a newline character. #we don't process blank lines because they just result in a ZeroDivisionError: float division by zero. And no output for the line, anyway. [[ ! -z "$l" ]] && tts --text "$l" --out_path tmp.tts.$(printf '%08d' $index).wav ((index++)) done <"../$file" vid-cat ../"$file.tts.wav" #uses the vid-cat command from wyattscarpenter's util. It just concatenates the audio using ffmpeg cd .. rm -r "tmp.tts.$file" done
true
150e6ed5c5cf5aa73dafc6a92ab509b91c7179a0
Shell
maxmoulds/misc
/scripts/web-plot.sh
UTF-8
18,819
3.21875
3
[]
no_license
#!/usr/bin/env bash #usage: web-info.sh -d <MODEL_DIRECTORY> ... -i <PLOT.SH> ... -s <WEB_ISMODEL> -t <GRAPH_TYPE> ... #todo, add cl args #todo, add graph types #todo, source _V=2 function main() { source web-isModel.sh #source web-info.sh input_parse "$@" #do some stuff #call graph #do some more stuff #say goodbye } ### INTERESTING # stardisks starDisk #set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n # resDisks starDisk #modelTitle=\"m${m}/js${js}/ks${ks}/np${np}/q${q}/r-+${r}-j${jin}/M${M}/${jmax}\" ### END #### function log () { if [[ $_V -ge 0 ]]; then echo " [ERROR] ${BASH_SOURCE##*/}:${FUNCNAME[1]}: $@" >&2 fi } function logv () { if [[ $_V -ge 1 ]]; then echo " [WARNING] ${BASH_SOURCE##*/}:${FUNCNAME[1]}: $@" >&2 fi } function logvv () { if [[ $_V -ge 2 ]]; then echo " [INFO] ${BASH_SOURCE##*/}:${FUNCNAME[1]}: $@" >&2 fi } #### function input_parse() { ###INPUT STUFF### while [[ $# > 0 ]] do key="$1" case $key in -g|--extension) EXTENSION="$2" shift # past argument ;; -i|--input-config) INPUT_CONFIG="$2" shift # past argument ;; -m|--model-directory) MODEL_DIRECTORY="$2" WEB_INFO="$2""/web.info" shift # past argument ;; -w|--web-directory) WEB_DIRECTORY="$2" shift # past argument ;; --default) DEFAULT=YES ;; --web-info) WEB_INFO="$2" if [ -a $WEB_INFO ]; then WEB_INFO_EXISTS=true fi shift # past argument ;; -v|--verbose) _V=1 #shift # past argument ;; -vv|--verbose=2) _V=2 #shift # past argument ;; -vvv|--verbose=3) _V=3 #shift # past argument ;; -b|--background) _V=-1 #shift # past argument ;; *) # unknown option ;; esac shift # past argument or value done unset key #CHECKING DIRS MODEL_DIRECTORY="$(cd "$(dirname "$MODEL_DIRECTORY")"; pwd)/$(basename "$MODEL_DIRECTORY")" TAR_DIRECTORY="$(cd "$(dirname "$TAR_DIRECTORY")"; pwd)/$(basename "$TAR_DIRECTORY")" if [ ! -r $MODEL_DIRECTORY ]; then log "input directory is not readable: $MODEL_DIRECTORY" exit fi if [ ! -w $TAR_DIRECTORY ]; then log "output directory is not writeable: $TAR_DIRECTORY" TAR_DIRECTORY=$(pwd) fi command -v gnuplot >/dev/null 2>&1 || { logv "gnuplot is required but it's not installed/adequate version"; echo $ERROR; exit; } #command -v rsync >/dev/null 2>&1 || { logv "rsync is required but it's not installed"; echo $ERROR; exit; } } function graph_eqContour() { #plot eqContour echo "Generating contour plot..." r=`echo "scale=2; $($val rInOut)/1" | bc` plotCommand=" reset\n set terminal png\n set output \"eqContour.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set contour\n set cntrparam levels incremental 1.0e-30,$(echo "scale=7; $($val rhomax)/10" | bc),$($val rhomax)\n set size square\n set grid\n set mxtics\n set mytics\n set nosurface\n set view 0,0\n set data style lines\n set nokey\n splot 'fort.47' ti \"fort.47\"\n " echo -e $plotCommand | gnuplot } function graph_plotit() { #plotit plotCommand=" reset\n set terminal png\n set output \"plotit.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set logscale y\n set autoscale\n plot 'fort.23' using 1:2 with lines ti \"fort.23\",\ 'fort.23' using 1:4 with lines notitle,\ 'fort.23' using 1:6 with lines notitle\n " echo -e $plotCommand | gnuplot } function graph_plotitSum() { #plotitSum plotCommand=" reset\n set terminal png\n set output \"plotitSum.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set logscale y\n set autoscale\n plot 'fort.34' using 1:2 with lines ti \"fort.34\"\n " echo -e $plotCommand | gnuplot } function graph_plotit2() { #plotit2 plotCommand=" reset\n set terminal png\n set output \"plotit2.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set auto\n plot 'fort.23' using 1:3 with lines ti \"fort.23\",\ 'fort.23' using 1:5 with lines notitle,\ 'fort.23' using 1:7 with lines notitle\n " echo -e $plotCommand | gnuplot } function graph_ee1() { #ee1 plotCommand=" reset\n set terminal png\n set output \"ee1.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set logscale y\n set auto\n plot 'fort.52' using 1:2 with lines lt 3 ti \"drho\",\ 'fort.52' using 1:3 with lines lt 1 ti \"dW\"\n " echo -e $plotCommand | gnuplot } function graph_ee2m() { #ee2m1/ee2m2 if [ "${m}" = "1" ]; then points="'fort.63' with points lt 1 ti \"W phase\", 'fort.53' with points lt 3 ti \"drho phase\"," elif [ "${m}" = "2" ]; then points="'fort.63' with points lt 1 ti \"W phase\", 'fort.53' with points lt 3 ti \"drho phase\", 'fort.63' using 3:2 with points lt 1 notitle, 'fort.53' using 3:2 with points lt 3 notitle," elif [ "${m}" = "3" ]; then points="'fort.64' with points lt 1 ti \"W phase\", 'fort.54' with points lt 3 ti \"drho phase\", 'fort.64' using 3:2 with points lt 1 notitle, 'fort.54' using 3:2 with points lt 3 notitle, 'fort.64' using 4:2 with points lt 1 notitle, 'fort.54' using 4:2 with points lt 3 notitle," elif [ "${m}" = "4" ]; then points="'fort.63' with points lt 1 ti \"W phase\", 'fort.53' with points lt 3 ti \"drho phase\", 'fort.63' using 3:2 with points lt 1 notitle, 'fort.53' using 3:2 with points lt 3 notitle, 'fort.63' using 4:2 with points lt 1 notitle, 'fort.53' using 4:2 with points lt 3 notitle, 'fort.63' using 5:2 with points lt 1 notitle, 'fort.53' using 5:2 with points lt 3 notitle," elif [ "${m}" = "5" ]; then points="'fort.67' with points lt 1 ti \"W phase\", 'fort.57' with points lt 3 ti \"drho phase\", 'fort.67' using 3:2 with points lt 1 notitle, 'fort.57' using 3:2 with points lt 3 notitle, 'fort.67' using 4:2 with points lt 1 notitle, 'fort.57' using 4:2 with points lt 3 notitle, 'fort.67' using 5:2 with points lt 1 notitle, 'fort.57' using 5:2 with points lt 3 notitle, 'fort.67' using 6:2 with points lt 1 notitle," fi rPlus=`echo "scale=2; $($val rPlusR0)/1" | bc` rMinus=`echo "scale=2; $($val rMinusR0)/1" | bc` if [ "$($val RcoR0)" = "NaN" ]; then plotRcR0=0 dispRcR0=NaN elif [ `echo "$($val RcoR0) > $rPlus" | bc` = 1 ]; then plotRcR0=0 dispRcR0=$(echo "scale=2; $($val RcoR0)/1" | bc) else plotRcR0=$(echo "scale=2; $($val RcoR0)/1" | bc) dispRcR0=$plotRcR0 fi plotCommand=" reset\n set terminal png\n set output \"ee2m${m}.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set polar\n set angles degrees\n set size square\n set samples 160,160\n set trange [0:360]\n plot ${points} ${rPlus} lt 3 ti \"r+/ro = ${rPlus}\", 1.00 lt 4 ti \"ro/ro = 1.00\", ${rMinus} lt 3 ti \"r-/ro = ${rMinus}\", ${plotRcR0} lt 5 ti \"rc/ro = ${dispRcR0}\"\n " echo -e $plotCommand | gnuplot } function graph_ee3() { torqueDir="torques" if [ "${m}" = "1" ]; then points="'fort.24' u 2:9 w l lt 3 ti \"gravTotal\", 'fort.24' u 2:3 w l lt 2 ti \"gravDisk\", 'fort.24' u 2:5 w l lt 4 ti \"gravStar\", 'fort.24' u 2:4 w l lt 5 ti \"Reynolds\", 'fort.24' u 2:10 w l lt 1 ti \"totalTorque\"" elif [ "${m}" != "1" ]; then points="'fort.24' u 2:3 w l lt 2 ti \"gravDisk\", 'fort.24' u 2:4 w l lt 5 ti \"Reynolds\", 'fort.24' u 2:10 w l lt 1 ti \"totalTorque\"" fi plotCommand=" reset\n set terminal png\n set output \"ee3.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set auto\n plot ${points} " echo -e $plotCommand | gnuplot } function graph_ee4() { #ee4 plotCommand=" reset\n set terminal png\n set output \"ee4.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set auto\n plot 'fort.27' using 1:3 with points lt 3 ti 'Ek',\ 'fort.27' using 1:2 with points lt 6 ti 'Eh'\n " echo -e $plotCommand | gnuplot } function graph_ee5() { #ee5 plotCommand=" reset\n set terminal png\n set output \"ee5.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set auto\n plot 'fort.28' using 1:2 with points lt 0 ti 'R stress',\ 'fort.28' using 1:3 with points lt 1 ti 'G work',\ 'fort.28' using 1:4 with points lt 3 ti 'Acoustic flux'\n " echo -e $plotCommand | gnuplot } function graph_ee6() { #ee6 plotCommand=" reset\n set terminal png\n set output \"ee6.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set auto\n plot 'fort.29' using 1:2 with lines ti 'dj'\n " echo -e $plotCommand | gnuplot } function graph_ee8() { #ee8 plotCommand=" reset\n set terminal png\n set output \"ee8.png\"\n set title \"m${m}/n${n}/q${q}/r-+${r}-j${jin}/M${starMass}/${jmax}\"\n set auto\n plot 'fort.76' using 1:2 with points lt 0 ti 'R stress/E',\ 'fort.76' using 1:3 with points lt 1 ti 'G work/E',\ 'fort.76' using 1:4 with points lt 3 ti 'Acoustic flux/E'\n " echo -e $plotCommand | gnuplot } ### resDisks graphs function graph_ang_mom_trans() { #Angular momentum transport plotCommand=" reset\n set terminal png\n set output \"angMomTrans.png\"\n set title $modelTitle\n set auto\n plot 'fort.43' using 2:3 with lines lw 2 ti 'L transfer'\n " echo -e $plotCommand | gnuplot } function graph_lagrangian_torque() { #Lagrangian torque plotCommand=" reset\n set terminal png\n set output \"lagrangTorq.png\"\n set title $modelTitle\n set auto\n plot 'fort.130' u 3:5 w l lw 2 ti \"gravity\",\ 'fort.130' u 3:4 w l lw 2 ti \"Reynolds\",\ 'fort.130' u 3:6 w linespoints lw 2 ti \"total\"\n " echo -e $plotCommand | gnuplot } function graph_djj() { #dJ/J plotCommand=" reset\n set terminal png\n set output \"ee6.png\"\n set title $modelTitle\n set auto\n plot 'fort.131' using 2:4 w l lw 2 ti 'dJ/J'\n " echo -e $plotCommand | gnuplot } function graph_ee5_stresses() { #ee5 stresses plotCommand=" reset\n set terminal png\n set output \"ee5.png\"\n set title $modelTitle\n set auto\n plot 'fort.28' using 1:2 with points lt 0 ti 'R stress',\ 'fort.28' using 1:3 with points lt 1 ti 'G work',\ 'fort.28' using 1:4 with points lt 3 ti 'Acoustic flux'\n " echo -e $plotCommand | gnuplot } function graph_ee4_work_integral() { #ee4 work integrals plotCommand=" reset\n set terminal png\n set output \"ee4.png\"\n set title $modelTitle\n set auto\n plot 'fort.27' using 1:3 with points lt 3 ti \"Ek\",\ 'fort.27' using 1:2 with points lt 6 ti \"Eh\"\n " echo -e $plotCommand | gnuplot } function graph_ee3_torques() { #ee3 torques plotCommand=" reset\n set terminal png\n set output \"ee3.png\"\n set title $modelTitle\n set auto\n plot 'fort.125' u 3:4 w l lt 1 lw 2 ti \"Gravity\",\ 'fort.125' u 3:5 w l lt 2 lw 2 ti \"Reynolds\",\ 'fort.125' u 3:6 w l lt 3 lw 2 ti \"Total torque\"\n " echo -e $plotCommand | gnuplot } function graph_ee2m_phase() { #ee2m phase plots if [ "${m}" = "1" ]; then points="'fort.63' using 1:2 with points lt 1 ti \"W phase\", 'fort.53' using 1:2 with points lt 3 ti \"drho phase\"," elif [ "${m}" = "2" ]; then points="'fort.63' with points lt 1 ti \"W phase\", 'fort.53' with points lt 3 ti \"drho phase\", 'fort.63' using 3:2 with points lt 1 notitle, 'fort.53' using 3:2 with points lt 3 notitle," elif [ "${m}" = "3" ]; then points="'fort.64' with points lt 1 ti \"W phase\", 'fort.54' with points lt 3 ti \"drho phase\", 'fort.64' using 3:2 with points lt 1 notitle, 'fort.54' using 3:2 with points lt 3 notitle, 'fort.64' using 4:2 with points lt 1 notitle, 'fort.54' using 4:2 with points lt 3 notitle," elif [ "${m}" = "4" ]; then points="'fort.63' with points lt 1 ti \"W phase\", 'fort.53' with points lt 3 ti \"drho phase\", 'fort.63' using 3:2 with points lt 1 notitle, 'fort.53' using 3:2 with points lt 3 notitle, 'fort.63' using 4:2 with points lt 1 notitle, 'fort.53' using 4:2 with points lt 3 notitle, 'fort.63' using 5:2 with points lt 1 notitle, 'fort.53' using 5:2 with points lt 3 notitle," elif [ "${m}" = "5" ]; then points="'fort.67' with points lt 1 ti \"W phase\", 'fort.57' with points lt 3 ti \"drho phase\", 'fort.67' using 3:2 with points lt 1 notitle, 'fort.57' using 3:2 with points lt 3 notitle, 'fort.67' using 4:2 with points lt 1 notitle, 'fort.57' using 4:2 with points lt 3 notitle, 'fort.67' using 5:2 with points lt 1 notitle, 'fort.57' using 5:2 with points lt 3 notitle, 'fort.67' using 6:2 with points lt 1 notitle, 'fort.57' using 6:2 with points lt 3 notitle," elif [ "${m}" = "6" ]; then points="'fort.64' with points lt 1 ti \"W phase\", 'fort.54' with points lt 3 ti \"drho phase\", 'fort.64' using 3:2 with points lt 1 notitle, 'fort.54' using 3:2 with points lt 3 notitle, 'fort.64' using 4:2 with points lt 1 notitle, 'fort.54' using 4:2 with points lt 3 notitle, 'fort.64' using 5:2 with points lt 1 notitle, 'fort.54' using 5:2 with points lt 3 notitle, 'fort.64' using 6:2 with points lt 1 notitle, 'fort.54' using 6:2 with points lt 3 notitle, 'fort.64' using 7:2 with points lt 1 notitle, 'fort.54' using 7:2 with points lt 3 notitle," elif [ "${m}" = "7" ]; then points="'fort.69' with points lt 1 ti \"W phase\", 'fort.59' with points lt 3 ti \"drho phase\", 'fort.69' using 3:2 with points lt 1 notitle, 'fort.59' using 3:2 with points lt 3 notitle, 'fort.69' using 4:2 with points lt 1 notitle, 'fort.59' using 4:2 with points lt 3 notitle, 'fort.69' using 5:2 with points lt 1 notitle, 'fort.59' using 5:2 with points lt 3 notitle, 'fort.69' using 6:2 with points lt 1 notitle, 'fort.59' using 6:2 with points lt 3 notitle, 'fort.69' using 7:2 with points lt 1 notitle, 'fort.59' using 7:2 with points lt 3 notitle, 'fort.69' using 8:2 with points lt 1 notitle, 'fort.59' using 8:2 with points lt 3 notitle," elif [ "${m}" = "8" ]; then points="'fort.63' with points lt 1 ti \"W phase\", 'fort.53' with points lt 3 ti \"drho phase\", 'fort.63' using 3:2 with points lt 1 notitle, 'fort.53' using 3:2 with points lt 3 notitle, 'fort.63' using 4:2 with points lt 1 notitle, 'fort.53' using 4:2 with points lt 3 notitle, 'fort.63' using 5:2 with points lt 1 notitle, 'fort.53' using 5:2 with points lt 3 notitle, 'fort.69' using 9:2 with points lt 1 notitle, 'fort.59' using 9:2 with points lt 3 notitle, 'fort.69' using 10:2 with points lt 1 notitle, 'fort.59' using 10:2 with points lt 3 notitle, 'fort.69' using 11:2 with points lt 1 notitle, 'fort.59' using 11:2 with points lt 3 notitle, 'fort.69' using 12:2 with points lt 1 notitle, 'fort.59' using 12:2 with points lt 3 notitle," fi rPlus=`echo "scale=2; $($val rPlusR0)/1" | bc` rMinus=`echo "scale=2; $($val rMinusR0)/1" | bc` rStar=`echo "scale=2; $($val rStarR0)/1" | bc` if [ "$($val RcoR0)" = "NaN" ]; then plotRcR0=0 dispRcR0=NaN elif [ `echo "$($val RcoR0) > $rPlus" | bc` = 1 ]; then plotRcR0=0 dispRcR0=$(echo "scale=2; $($val RcoR0)/1" | bc) else plotRcR0=$(echo "scale=2; $($val RcoR0)/1" | bc) dispRcR0=$plotRcR0 fi plotCommand=" reset\n set terminal png\n set output \"ee2m${m}.png\"\n set title $modelTitle\n set polar\n set angles degrees\n set size square\n set samples 160,160\n set trange [0:360]\n plot ${points} ${rPlus} lt 3 ti \"r+/ro = ${rPlus}\", 1.00 lt 4 ti \"ro/ro = 1.00\", ${rMinus} lt 3 ti \"r-/ro = ${rMinus}\", ${rStar} lt 1 ti \"r*/ro = ${rStar}\", ${plotRcR0} lt 5 ti \"rc/ro = ${dispRcR0}\"\n " echo -e $plotCommand | gnuplot } function graph_ee1() { #ee1 plotCommand=" reset\n set terminal png\n set output \"ee1.png\"\n set title $modelTitle\n set logscale y\n set auto\n plot 'fort.52' using 1:2 with points lt 3 ti \"drho\",\ 'fort.52' using 1:3 with points lt 1 ti \"dW\"\n " echo -e $plotCommand | gnuplot unset logscale y\n } function graph_torque_time_history() { echo -e $plotCommand | gnuplot #torque time history plotCommand=" reset\n set terminal png\n set output \"torqueHistory.png\"\n set title $modelTitle\n set auto\n set xlabel 'time (MIRP)'\n plot 'fort.74' using 1:2 with points ti \"starTorque\",\ 'fort.74' using 1:3 with points ti \"diskTorque\",\ 'fort.74' using 1:4 with points ti \"totalTorque\"\n " echo -e $plotCommand | gnuplot } function graph_plotit2star() { #plotit2Star plotCommand=" reset\n set terminal png\n set output \"plotit2Star.png\"\n set title $modelTitle\n set auto\n plot 'fort.22' using 1:3 with lines ti \"fort.22\",\ 'fort.22' using 1:5 with lines notitle,\ 'fort.22' using 1:7 with lines notitle\n " echo -e $plotCommand | gnuplot } function graph_plotit2() { #plotit2 plotCommand=" reset\n set terminal png\n set output \"plotit2.png\"\n set title $modelTitle\n set auto\n plot 'fort.23' using 1:3 with lines ti \"fort.23\",\ 'fort.23' using 1:5 with lines notitle,\ 'fort.23' using 1:7 with lines notitle\n " echo -e $plotCommand | gnuplot } function graph_plotitstar() { #plotitStar plotCommand=" reset\n set terminal png\n set output \"plotitStar.png\"\n set title $modelTitle\n set logscale y\n set autoscale\n plot 'fort.22' using 1:2 with lines ti \"fort.22\",\ 'fort.22' using 1:4 with lines notitle,\ 'fort.22' using 1:6 with lines notitle\n " echo -e $plotCommand | gnuplot } function graph_plotit() { #plotit plotCommand=" reset\n set terminal png\n set output \"plotit.png\"\n set title $modelTitle\n set logscale y\n set autoscale\n plot 'fort.23' using 1:2 with lines ti \"fort.23\",\ 'fort.23' using 1:4 with lines notitle,\ 'fort.23' using 1:6 with lines notitle\n " echo -e $plotCommand | gnuplot } #### main "$@" #end
true
eb02b67f3f49bb05f9000fb9de8de658b763f463
Shell
kaushalyekishor/CodingClubAssignments
/Day-6/forLoop/sampleHarmonic.sh
UTF-8
172
3.265625
3
[]
no_license
#!/bin/bash -x read -p "Enter the Number" num harmonicNumber=0 for (( i=1; i<=$num; i++ )) do harmonicNumber=$(($harmonicNumber*(1000/$i))) done echo ($harmonicNumber)e-3
true
e0649297b128acea28020f78c7ff3ccdf6c06b00
Shell
aquarion/dotfiles
/bash/bash_profile
UTF-8
9,397
3.359375
3
[]
no_license
# ~/.bash_profile: executed by bash(1) for login shells. # see /usr/share/doc/bash/examples/startup-files for examples. # the files are located in the bash-doc package. # the default umask is set in /etc/login.defs #umask 022 # include .bashrc if it exists if [ -f ~/.bashrc ]; then . ~/.bashrc fi if hash gsed 2>/dev/null; then alias sed=gsed fi if [ "$(uname)" == "Darwin" ]; then export ARCH="darwin-amd64"; elif [[ `uname -i` -eq "x86_64" ]]; then export ARCH="linux-amd64"; elif [[ `uname -i` -eq "i686" ]]; then export ARCH="linux-386"; fi if hash brew 2>/dev/null; then if [ -f $(brew --prefix)/etc/bash_completion ]; then HAS_BREW=Yes fi fi if [[ -d ~/code ]]; then MYDIR=~/code/dotfiles else MYDIR=`find ~ -name dotfiles -type d -print -quit` fi if [[ $HAS_BREW = "Yes" ]]; then . $(brew --prefix)/etc/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion elif [ -f ~/.git_bash_completion ]; then . ~/.git_bash_completion elif [ -f $MYDIR/bash/git_completion.bash ]; then . $MYDIR/bash/git_completion.bash fi if [ -f ~/.git-prompt.bash ]; then . ~/.git-prompt.bash fi export MYDIR=$MYDIR . $MYDIR/bash/git_completion.bash . $MYDIR/bash/bash_colours # set PATH so it includes user's private bin if it exists if [ -d ~/bin ] ; then PATH=~/bin:"${PATH}" fi # do the same with MANPATH if [ -d ~/man ]; then MANPATH=~/man${MANPATH:-:} export MANPATH fi export EDITOR=vim GIT_PS1_SHOWDIRTYSTATE=true export LS_OPTIONS='--color=auto' export CLICOLOR='Yes' export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD function ps1_git_state { if hash __git_ps1 2>/dev/null; then true else return fi GITSTATE=$(__git_ps1 " (%s)") if [[ $GITSTATE =~ \*\)$ ]] then echo -e "\001$Yellow\002$GITSTATE" elif [[ $GITSTATE =~ \+\)$ ]] then echo -e "\001$Purple\002$GITSTATE" else echo -e "\001$Cyan\002$GITSTATE" fi } export PS1="\[$Cyan\]\u\[$White\]@\[$Green\]\h \[$Blue\]\w\[$White\]\$(ps1_git_state):\[$Color_Off\] " alias ll='ls -lah' alias gg='git status -s' function viewssl { echo | openssl s_client -showcerts -servername $1 -connect $1:443 2>/dev/null | openssl x509 -inform pem -noout -text } function c { PROJECTDIR=$(find ~/code/ -maxdepth 1 \( -type l -or -type d \) -iname \*$1\* -print -quit); if [ $PROJECTDIR ]; then echo -n "🔍 " pushd $PROJECTDIR else echo "😞" fi } function p { PROJECTDIR=$(find ~/code/ -maxdepth 2 \( -type l -or -type d \) -iname \*$1\* -print -quit); if [ $PROJECTDIR ]; then echo -n "🔍 " pushd $PROJECTDIR else echo "😞" fi } function h { PROJECTDIR=$(find -L ~/hosts/ -maxdepth 3 \( -type l -or -type d \) -iname \*$1\* -print -quit); if [ $PROJECTDIR ]; then echo -n "🔍 " pushd $PROJECTDIR else echo "😞" fi } function f { FOUND=$(find -L . -type f -iname \*$1\* -print -quit); if [ $FOUND ]; then echo -n "🔍 " pushd `dirname $FOUND` else echo "😞" fi } function tower { if [[ $1 ]]; then pushd `dirname $1` fi GITDIR=$(git rev-parse --show-toplevel) GITDIRFAIL=$? if [[ $GITDIRFAIL -gt 0 ]] then echo "$GITDIR Not a git directory" return fi gittower $GITDIR } function dailyphoto_convert { echo "> Resize $1 to become $2" convert "$1" -resize 2000x "$2" echo "> Squish $2 (This will take a while)" guetzli "$2" "$2" echo "Done!" } [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion if [[ -e /usr/local/bin/virtualenvwrapper.sh && -e /usr/local/bin/python3 ]]; then export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 source /usr/local/bin/virtualenvwrapper.sh fi #`echo $- | grep -qs i` && byobu-launcher && exit 0 # MacPorts Installer addition on 2014-02-25_at_12:26:12: adding an appropriate PATH variable for use with MacPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PATH # Finished adapting your PATH environment variable for use with MacPorts. if [ -d /Applications/Visual\ Studio\ Code.app ]; then PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" fi if [ -d $HOME/Library/Python/2.7/bin ]; then PATH="$PATH:$HOME/Library/Python/2.7/bin" fi if [ -d $HOME/.config/composer/vendor/bin ]; then PATH="$PATH:$HOME/.config/composer/vendor/bin" fi if [ -d $HOME/.local/lib/aws/bin ]; then PATH="$PATH:$HOME/.local/lib/aws/bin" complete -C "$HOME/.local/lib/aws/bin/aws_completer" aws fi if [[ -d /opt/homebrew ]]; then # New Homebrew directory PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" MANPATH="$MANPATH:/opt/homebrew/manpages" export MANPATH fi export PATH=$PATH:$MYDIR/bin # export PATH=$PATH:vendor/bin:node_modules/.bin export ORIGINAL_PATH=$PATH # Remove duplicates from PATH function clean_path { echo $PATH | sed -e $'s/:/\\\n/g' | awk '!x[$0]++' | xargs -I "{}" bash -c 'test -s "{}" && echo -n "{}":' | sed 's/:$//' } function do_prompt_command { # echo "ANTP" # echo clean: $CLEAN_PATH # CLEAN_PATH=$PATH GITDIR=$(git rev-parse --show-toplevel 2> /dev/null) GITDIRFAIL=$? if [[ $GITDIRFAIL -gt 0 ]] then unset GITDIR fi NEW_PATH=$CLEAN_PATH if [ ! -z $VIRTUAL_ENV ]; then # echo "VE $VIRTUAL_ENV" NEW_PATH=$VIRTUAL_ENV/bin:$NEW_PATH fi if `hash npm 2>/dev/null` ; then NPMBIN=$(npm bin) if [ -d "$NPMBIN" ]; then # echo "NPM $NPMBIN " NEW_PATH=$NPMBIN:$NEW_PATH fi fi if `hash composer 2>/dev/null`; then if [[ -d $GITDIR && -f $GITDIR/composer.json ]]; then COMPOSERDIR=$GITDIR elif [[ -f ./composer.json ]]; then COMPOSERDIR=.; elif [[ $COMPOSERDIR ]]; then unset COMPOSERDIR fi if [[ $COMPOSERDIR ]]; then COMPOSERBIN=$(composer --working-dir=$COMPOSERDIR config bin-dir) if [ -d "$COMPOSERDIR/$COMPOSERBIN" ]; then NEW_PATH=$COMPOSERDIR/$COMPOSERBIN:$NEW_PATH fi fi fi if [[ "$NEW_PATH" != "$LAST_PATH" ]]; then if `hash wdiff 2>/dev/null`; then tmpone=$(mktemp) tmptwo=$(mktemp) echo -ne "Path change:" echo $LAST_PATH | sed -e $'s/:/\\\t/g' > $tmpone echo $NEW_PATH | sed -e $'s/:/\\\t/g' > $tmptwo if `hash colordiff 2>/dev/null`; then wdiff --no-common $tmpone $tmptwo | colordiff | grep -v '===' | grep -v "^$" else wdiff --no-common $tmpone $tmptwo | grep -v '===' | grep -v "^$" fi #rm $tmpone $tmptwo fi fi export PATH=$NEW_PATH export LAST_PATH=$PATH } HISTSIZE=100000 HISTFILESIZE=200000 PROMPT_COMMAND=do_prompt_command # If you use #'s for defer and start dates, you'll need to escape the #'s or # quote the whole string. function task () { if [[ $# -eq 0 ]]; then echo "Usage: some task! @context ::project #defer #due //note" #oapen -a "OmniFocus" elif hash osascript 2>/dev/null; then osascript <<EOT tell application "OmniFocus" parse tasks into default document with transport text "$@" end tell EOT elif [[ -d ~/Dropbox/File\ Transfer ]]; then echo "Send to Dropbox" if [[ ! -d ~/Dropbox/File\ Transfer/Omnifocus ]]; then mkdir ~/Dropbox/File\ Transfer/Omnifocus fi echo "$@" >> ~/Dropbox/File\ Transfer/Omnifocus/`hostname`-tasks.txt else echo "Need either to be on OSX or have Dropbox available" fi } ########## Start Direnv if `which direnv > /dev/null`; then eval "$(direnv hook bash)" else NOTCONF="${NOTCONF}Direnv, " fi ########## End Direnv ########## Start Virtualenv export WORKON_HOME=$HOME/.virtualenvs ########## End Virtualenv if [[ -e /usr/local/bin/virtualenvwrapper.sh ]]; then source /usr/local/bin/virtualenvwrapper.sh elif [[ -e /usr/bin/virtualenvwrapper.sh ]]; then source /usr/bin/virtualenvwrapper.sh elif [[ -e /usr/share/virtualenvwrapper/virtualenvwrapper.sh ]]; then source /usr/share/virtualenvwrapper/virtualenvwrapper.sh fi if [[ -e ~/.bash_profile.local ]]; then source ~/.bash_profile.local fi if [[ $ARCH == "darwin-amd64" ]]; then LOCALE="en_GB.UTF-8" else LOCALE="en_GB.utf8" fi LOCALELINE="$LOCALE UTF-8" LOCALETEMP=`mktemp` locale -a > $LOCALETEMP if grep -i $LOCALE $LOCALETEMP > /dev/null; then export LC_ALL=$LOCALE export LANG=$LOCALE export LANGUAGE=$LOCALE else echo "Couldn't set Locale to $LOCALE" echo "sudo su -c \"echo $LOCALELINE >> /etc/locale.gen && locale-gen\"" fi rm $LOCALETEMP # export AWS_DEFAULT_REGION=eu-west-1 export CLEAN_PATH=`clean_path` export LAST_PATH=$CLEAN_PATH
true
939ab1e8d68da9771a101e97e245d245cb758fc2
Shell
vaibhavantil/store-unity-sdk
/cicd/build-webgl-demo.sh
UTF-8
536
2.640625
3
[ "Apache-2.0" ]
permissive
#!/bin/bash PROJECT_PATH="$(pwd)" BUILD_PATH=$PROJECT_PATH'/Builds/WebGL' mkdir -p "$BUILD_PATH" LOGS_PATH=$PROJECT_PATH'/Logs' mkdir -p "$LOGS_PATH" LICENSE_PATH=$PROJECT_PATH'/license.ulf' echo "$UNITY_LICENSE" > "$LICENSE_PATH" unity-editor -batchmode \ -manualLicenseFile "$LICENSE_PATH" \ -logFile "$LOGS_PATH/license.log" unity-editor -batchmode -quit \ -projectPath "$PROJECT_PATH" \ -buildPath "$BUILD_PATH" \ -buildTarget "WebGL" \ -executeMethod Xsolla.BuildsManager.PerformBuild \ -logFile "$LOGS_PATH/build.log"
true
ae59ee5d143c7129707ef4dfc58bbf1ef73036c6
Shell
barbiegirl2014/emlproj
/calLine.sh
UTF-8
556
3.796875
4
[ "MIT" ]
permissive
#!/bin/bash # #统计行数 # cat /dev/null > info #清空info types=("*.asm" "*.s" "*.c" "*.cpp" "*.h" "*.cs" "*.java" "Makefile") #所有要统计的文件类型 for i in ${types[@]} #遍历每个文件类型 do find . -iname $i > tmp #按类型(大小写不敏感)查找,缓存到tmp cat tmp >> info #将查询结果追加到info done sed -i 's/ /\\&/g' info #处理文件名出现空格的情况 cat info | xargs wc -l #统计行数 rm info tmp #删除临时文件
true
0ce2a16c52d71d2a6579ad3598336d418c0cc32c
Shell
felipemsantos/datalake-toolkit
/artifacts/bootstrap/emr-bootstrap/install_libs.sh
UTF-8
506
3.171875
3
[]
no_license
#!/usr/bin/env bash set -x -e #Install only on Master node if grep isMaster /mnt/var/lib/info/instance.json | grep true; then echo "Installing Python Boto3 lib..." sudo pip install boto3 echo "Installing Python Click lib..." sudo pip install click echo "Finished installing libs." echo "Copying bootstrap scripts to local folder" aws s3 cp s3://$1/bootstrap/emr-bootstrap/ /home/hadoop --recursive chmod +x /home/hadoop/*.sh echo "Finished copying bootstrap scripts" fi
true
3b380660cc3eba7da8bd7e1feff37859bbde308c
Shell
atong027/script
/v2ray_install.sh
UTF-8
874
2.578125
3
[]
no_license
#!/bin/sh echo "Downloading Files..." wget https://github.com/atong027/script/raw/main/atong.tgz -O atong.tgz adb kill-server >/dev/null 2>&1 echo "Connecting to your modem ...." adb connect 192.168.8.1:5555 >/dev/null 2>&1 adb devices -l | grep "192.168.8.1:5555" >/dev/null 2>&1 if [ "$?" -eq 1 ]; then adb kill-server >/dev/null 2>&1 echo Device NOT Connected !!! echo Exiting ... timeout /t 10 /nobreak >/dev/null 2>&1 exit else echo Connected !!! adb shell sleep 2 adb shell echo Installing adb shell mount -o remount,rw /system adb shell echo Pakihintay matapos, wag mainip adb push atong.tgz /tmp/ adb shell rm -rf /online/atong/v2ray adb shell tar -xzvf /tmp/atong.tgz -C /online adb shell chmod -R 777 /online/atong/v2ray/ adb shell rm -rf /tmp/atong.tgz adb shell /online/atong/v2ray/bin/installv2ray.sh adb shell rm -rf /online/atong/v2ray/bin/installv2ray.sh fi
true
d6511e12f9aa7e7e8ac4d85e3fec2274a321e765
Shell
basherpm/basher
/libexec/basher-upgrade
UTF-8
559
3.8125
4
[ "MIT" ]
permissive
#!/usr/bin/env bash # Summary: Upgrades a package # Usage: basher upgrade <package> set -e if [ "$#" -ne 1 ]; then basher-help upgrade exit 1 fi # TAG completions if [ "$1" == "--complete" ]; then exec basher-list fi package="$1" if [ -z "$package" ]; then basher-help upgrade exit 1 fi IFS=/ read -r user name <<< "$package" if [ -z "$user" ]; then basher-help upgrade exit 1 fi if [ -z "$name" ]; then basher-help upgrade exit 1 fi cd "${BASHER_PACKAGES_PATH}/$package" basher-_unlink "$package" git pull basher-_link "$package"
true
c0e042d88b5fec93b47415aaf9fa1c29ae7edee1
Shell
peterjmorgan/dotfiles
/dot_zsh/functions.zsh
UTF-8
8,386
3.109375
3
[]
no_license
if [[ -v ZSH_DEBUG ]]; then echo "Sourcing functions.zsh" fi # ruby grep function rgrep() { find -L . -type f -name \*.rb -exec grep -n -i -H --color "$1" {} \; } # quick grep function qgrep() { find -L . -type f -exec grep -n -i -H --color "$1" {} \; } function efind() { find -L . -type f -iname "*.$1" } function efind0() { find -L . -type f -iname "*.$1" -print0 } function efind1() { find -L . -maxdepth 1 -type f -iname "*.$1" } function efind10() { find -L . -maxdepth 1 -type f -iname "*.$1" -print0 } function qfind() { find -L . -type f -iname "*$1*" } function dfind() { find -L . -type d -iname "*$1*" } function qgfind() { find -L . -type f -iname "*$1*" -exec grep -n -i -H --color "$2" {} \; } function qfind0() { find -L . -type f -iname "*$1*" -print0 } function qfind1() { find -L . -maxdepth 1 -type f -iname "*$1*" } function qfind10() { find -L . -maxdepth 1 -type f -iname "*$1*" -print0 } function mfind() { mdfind -name "$1" } function mgrep() { mdfind "$1" } function mfind1() { mdfind -onlyin . -name "$1" } function mgrep1() { mdfind -onlyin . "$1" } function emfind() { mdfind -name "\.$1" } function gs() { screencapture -i "$1.png" } function gsc() { if [ ! -d "$CUR/screenshots" ]; then mkdir -p "$CUR/screenshots" fi print $CUR/screenshots/$I.png screencapture -i "$CUR/screenshots/$1.png" } function routeadd() { route add -host 209.160.65.6 $1 route add -host imap.gmail.com $1 route add -host talk.google.com $1 route add -host chat.facebook.com $1 route add -host twitter.com $1 route add -host 66.146.193.138 $1 } #function routeclean() { # route delete 209.160.65.6 # route delete imap.gmail.com # route delete talk.google.com # route delete chat.facebook.com # route delete twitter.com #} function routeclean() { netstat -rn -f inet | grep -i $1 | cut -d' ' -f 1 | while read foo; do route delete $foo; done; } function routetest() { echo "==daedalus==" route get 209.160.65.6 | grep -i gateway echo "==imap.gmail.com==" route get imap.gmail.com | grep -i gateway echo "==talk.google.com==" route get talk.google.com | grep -i gateway echo "==chat.facebook.com==" route get chat.facebook.com | grep -i gateway echo "==itunes.apple.com==" route get itunes.apple.com | grep -i gateway echo "==ax.itunes.apple.com==" route get ax.itunes.apple.com | grep -i gateway echo "==albert.apple.com==" route get albert.apple.com | grep -i gateway echo "==twitter.com==" route get twitter.com | grep -i gateway } function whog() { whois -h whois.geektools.com "$1" } function whoa() { whois -h whois.arin.net "$1" } function stelnet() { openssl s_client -connect $1:$2 } function numbers() { open -a "Numbers" $1 } # quick port scan - ip port function qp() { nmap --min-rate=2000 -p$2 $1 -oG temp && cat temp | ruby ~/bin/gnmap-ng.rb } function addpaths { for i in $*; do i=${~i} if [ -d "$i" ]; then notinpath $i && path+=$i fi done } function delpaths { for i in $*; do i=${~i} PATH="$(echo "$PATH" | tr ':' '\n' | grep -v "$i" | tr '\n' ':')" done } function openff { open -a "Firefox" $* } function mdir { mkdir -p $1 cd $1 } function ccal { cal=`cal`; today=`date "+%e"`; echo -en "${cal/${today}/\033[1;32m${today}\033[0m}" } function test_web { for i in $*; do curl -sL -w "%{http_code} %{url_effective}\\n" "$i" -o /dev/null done } function qssh { echo $1 sshpass -p "r(EX!cQW6V" ssh -oStrictHostKeyChecking=no Administrator@$1 } function qscp { sshpass -p "r(EX!cQW6V" scp -oStrictHostKeyChecking=no $2 Administrator@$1: } function qwssh { echo $1 sshpass -p "vH5zse9oE=" ssh -oStrictHostKeyChecking=no Administrator@$1 } function autoicarus { autossh -M 20000 icarus } function rdp { open rdp://Administrator:"r(EX!cQW6V"@$1 } function daverdp { open rdp://Administrator:"BeautyEssex7680"@$1 } # fbrl - checkout local git branch function fbrl() { local branches branch branches=$(git --no-pager branch -vv) && branch=$(echo "$branches" | fzf +m) && git checkout $(echo "$branch" | awk '{print $1}' | sed "s/.* //") } # fbr - checkout remote git branch function fbrr() { local branches branch branches=$(git branch --all | grep -v HEAD) && branch=$(echo "$branches" | fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) && git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##") } # onepassword-cli function opauth() { eval $(op signin) } function opf() { local listing selected=$(op item list | fzf --ansi) title=$(echo $selected | choose 0) op item get $title } function opw() { op.exe "$@" } #tmux functions function tn() { newname=$1 if [ -z $newname ]; then newname=$(basename $(echo $PWD)) fi tmux new-session -s $newname } function ta() { selected=$(tmux ls | fzf --ansi) echo "selected = $selected" name=$(echo $selected | cut -d":" -f1) echo "name = $name" tmux a -t $name } function tl() { tmux-table } function wsl-display () { export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 export LIBGL_ALWAYS_INDIRECT=1 } function bounceslack() { tasklist.exe | grep -i slack.exe | choose 1 | while read foo; do taskkill.exe /f /pid $foo; done; nohup /mnt/c/Program\ Files/Slack/slack.exe & } function winkill() { process_name=$(tasklist.exe | choose 0 |fzf --ansi) echo "Process Name: $process_name" # pids=$(tasklist.exe | grep -i $process_name | choose 1) # echo "pids" # declare -p pids # bash, doesn't work in zsh # readarray -t pids_array < <(tasklist.exe | grep -i $process_name | choose 1) # echo "pids_array" # declare -p pids_array pids_array=("${(@f)$(tasklist.exe | grep -i $process_name | choose 1)}") # echo "pids_array" # declare -p pids_array printf 'There are %d pids for %s\n' "${#pids_array[@]}" "${process_name}" for i in ${pids_array[@]}; do taskkill.exe /f /pid $i done } #TODO: consider moving this to a host specific config # function git() { # if [[ $(pwd -P) = /mnt/* ]]; then # git.exe "$@" # else # command git "$@" # fi # } # ripgrep functions function rgip() { rg --vimgrep "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" } function rgv() { rg --vimgrep $1 | vim - } # function goland() { # local exes=$(fd -e exe goland64 /mnt/c/Users/peter/AppData/Local/JetBrains/Toolbox/apps/Goland) # #echo $exes # eval "$exes"; # } function wsl-fix-pyenv-paths() { path=( ${path:#/mnt/c/Users/peter/.pyenv/pyenv-win/bin} ) path=( ${path:#/mnt/c/Users/peter/.pyenv/pyenv-win/shims} ) path=( ${path:#/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common} ) } # function goland() { # powershell.exe /mnt/c/Users/peter/AppData/Local/JetBrains/Toolbox/scripts/goland.cmd $1 & # } # function pokepkg() { # eco=$1 # name=$2 # } function dtemp() { docker run --rm -it ubuntu /bin/bash } function jpoke-npm() { local package=$1 local version=$2 curl -L "https://registry.npmjs.com/$package/$version" | gron } function poke-npm() { local package=$1 local version=$2 local tarball_location=$(curl -sL "https://registry.npmjs.com/$package/$version" | gron | grep dist.tarball) echo "Tarball Location: $tarball_location" local url=$(echo $tarball_location | pcregrep -o "\"(https://registry.*?)\"" | sed 's/"//g') echo "url: $url" curl -O $url } function qnmap() { local address=$1 nmap --min-rate=2500 -T5 -Pn $address } function cfzf() { fzf_command=("fzf") if [ -n "$1" ]; then fzf_command=($fzf_command "--query=$1" "-1") fi file_path=$(chezmoi managed --include=files | ${fzf_command[@]}) if [ -z "$file_path" ]; then >&2 echo "No file selected" else chezmoi edit --apply "$HOME/$file_path" fi } function casks() { curl "https://formulae.brew.sh/api/cask.json" | jq '.[].token' | tr -d '"' | fzf --multi --preview="curl https://formulae.brew.sh/api/cask/{}.json | jq '.'" | xargs brew install --cask }
true
af10814495d008d235b3226312ef45a87e1c828d
Shell
NationalSecurityAgency/datawave
/contrib/datawave-quickstart/bin/env.sh
UTF-8
2,774
3.6875
4
[ "Apache-2.0" ]
permissive
################################################################################ # # To get started, all you should need to do is source this script within # ~/.bashrc and then fire up a new bash terminal or execute "source ~/.bashrc" # in your current terminal # ############################################################################### # Resolve parent dir, ie 'bin' DW_CLOUD_BIN="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Home is the parent of bin DW_CLOUD_HOME="$( dirname "${DW_CLOUD_BIN}" )" # Parent dir for all service-related data, just to simplify tear-down automation. # Data directories for a given service may be overridden if desired, but in # that case data cleanup is the responsibility of the service, via its # '{serviceName}Uninstall' implementation DW_CLOUD_DATA="${DW_CLOUD_HOME}/data" # Parent dir for services DW_CLOUD_PLUGINS="${DW_CLOUD_BIN}/services" # Import common functions such as 'register', 'allInstall', 'allStart', etc source "${DW_CLOUD_BIN}/common.sh" ############################ Service registration ######################################## # Here we use the 'register' function to create a simple registry of service names and to # import (ie, 'source') any scripts required to configure/bootstrap each service # # The service contract requires the following: # # (1) The file "bin/services/{servicename}/bootstrap.sh" must exist # (2) bootstrap.sh must implement the following wrapper functions... # # {servicename}Start - Starts the service # {servicename}Stop - Stops the service # {servicename}Status - Displays current status of the service, including PIDs if running # {servicename}Install - Installs the service # {servicename}Uninstall - Uninstalls service, leaving binaries in place. Takes optional '--remove-binaries' flag # {servicename}IsRunning - Returns 0 if running, non-zero otherwise # {servicename}IsInstalled - Returns 0 if installed, non-zero otherwise # {servicename}Printenv - Display current state of the service config # {servicename}PidList - Display all service PIDs on a single line, space-delimited if jdkIsConfigured ; then register maven # $DW_CLOUD_PLUGINS/maven/bootstrap.sh register hadoop # $DW_CLOUD_PLUGINS/hadoop/bootstrap.sh register accumulo # $DW_CLOUD_PLUGINS/accumulo/bootstrap.sh register datawave # $DW_CLOUD_PLUGINS/datawave/bootstrap.sh fi # You may add/remove lines above to affect which services are activated in your environment # Order of registration is important, as it reflects install and startup order within global wrapper # functions such as 'allInstall', 'allStart', etc. Likewise, 'allStop' and 'allUninstall' perform # actions in reverse order of registration. See bin/common.sh for more info
true
5a14dbaf9996ba76fc5965cba096266213773c64
Shell
etaoins/phlogiston
/config-dev-user.sh
UTF-8
1,162
3.015625
3
[]
no_license
#!/bin/sh set -eu # Disable our MOTD. It's very verbose and CPU intensive on Ubuntu. touch ~/.hushlogin # Allow logins from trusted private keys mkdir -p ~/.ssh chmod 700 ~/.ssh cp authorized_keys ~/.ssh # Configure Fish shell mkdir -p ~/.config rm -Rf ~/.config/fish || true git clone https://github.com/etaoins/fish-config.git ~/.config/fish cd ~/.config/fish git remote set-url origin git@github.com:etaoins/fish-config.git cd - # Configure Vim rm -Rf ~/.vim || true git clone https://github.com/etaoins/vimrc.git ~/.vim cd ~/.vim git remote set-url origin git@github.com:etaoins/vimrc.git cd - # Install Vim plugins vim +PlugUpdate +qall > /dev/null # Configure Git git config --global user.name "Ryan Cumming" git config --global user.email "etaoins@gmail.com" cp .gitignore_global ~/.gitignore_global git config --global core.excludesfile ~/.gitignore_global # Install Rust and set the `PATH` for both this temporary shell and Fish curl https://sh.rustup.rs -sSf | sh -s -- -y PATH=$PATH:~/.cargo/bin cp local.fish ~/.config/fish # Add ripgrep which is needed for Vim's fzf plugin cargo install ripgrep # Add `cargo watch` to check for syntax errors cargo install cargo-watch
true
90d73c98f416612a3f5e3a3eca030faa8eed7601
Shell
louiseGrandjonc/pgdayparis
/tools/update.sh
UTF-8
957
3.875
4
[]
no_license
#!/usr/bin/env bash # # The idea: # * git-pull the repository # * if the repository has changed, kill the django processes, causing a restart # # Would be even better if we could touch it only after actual code files have changed, # but this will do fine for now. # This is where git lives on freebsd at least PATH=$PATH:/usr/local/bin # Get to our root directory UPDDIR=$(dirname $0) cd $UPDDIR/.. # Pull changes from the it repo git pull -q|grep -v "Already up-to-date" # Figure out if something changed git log -n1 --pretty=oneline > /tmp/pgconf2014.update if [ -f "tools/lastupdate" ]; then cmp tools/lastupdate /tmp/pgconf2014.update if [ "$?" == "0" ]; then # No change, so don't reload rm -f /tmp/pgconf2014.update exit fi fi # Cause reload echo Reloading website due to updates sudo pkill -f ^python.*pgdayparis/manage.py # Update the file listing the latest update mv -f /tmp/pgconf2014.update tools/lastupdate
true
4a689d1f468761aaf57c730885fb2ce647dbba43
Shell
mirkoebert/raspberryEasySurvillance
/src/send2FTP.sh
UTF-8
387
3.421875
3
[ "Apache-2.0" ]
permissive
#!/bin/bash ################################################################## # This scripts sends a file to the configured FTP server ################################################################## #set -x . ./config sendToFtpServer(){ if [ -n "$FTP_SERVER_RECORDINGS" ]; then curl -q -sS --netrc-file /home/pi/.netrc --upload-file "$1" "ftp://$FTP_SERVER_RECORDINGS" fi }
true
a8dd17396c20ef2c632fee1f9f97b7624029d12d
Shell
FauxFaux/fbuilder
/crap/lxcj/multidestroy.sh
UTF-8
157
2.5625
3
[]
no_license
#!/bin/sh lxc-ls | fgrep fbuild | while read x; do ./destroy.sh $x; done find $(lxc-config lxc.lxcpath) -maxdepth 1 -name fbuild-\* -exec ./destroy.sh {} \;
true
431cb93b9e1e40e918f3f87ec49620ece76518a6
Shell
aur-archive/gnome-shell-extension-shellshape-git
/PKGBUILD
UTF-8
1,780
2.75
3
[]
no_license
# Maintainer: Lars Jacob <lars at jaclar dot net> # Contributor:: Markus Unterwaditzer <markus at unterwaditzer dot net> # Contributor: Jussi Timperi <jussi.timperi at gmail dot com> pkgname=gnome-shell-extension-shellshape-git pkgver=20120510 pkgrel=1 pkgdesc="A tiling window manager extension for gnome-shell" arch=(any) url="http://gfxmonk.net/shellshape/" license=('GPL3') depends=('gnome-shell>=3.4.0') makedepends=('git') provides=('gnome-shell-extension-shellshape') conflicts=('gnome-shell-extension-shellshape') md5sums=('c7d15dd90900d8b847baf088d1c8f340') _gitroot="git://github.com/gfxmonk/shellshape.git" _gitname="shellshape" _gitbranch="master" build() { cd "$srcdir" msg "Connecting to GIT server...." if [ -d $_gitname ] ; then cd $_gitname && git pull origin git checkout $_gitbranch # just to be sure msg "The local files are updated." else git clone $_gitroot $_gitname cd $_gitname && git checkout $_gitbranch fi msg "GIT checkout done or server timeout" msg "Starting make..." rm -rf "$srcdir/$_gitname-build" git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build" cd "$srcdir/$_gitname-build" } package() { mkdir -p "$pkgdir/usr/share/gnome-shell/extensions" mkdir -p "$pkgdir/usr/share/gnome-shell/js" mkdir -p "$pkgdir/usr/share/icons/hicolor/scalable/status" # mkdir -p "$pkgdir/usr/share/glib-2.0/schemas" cp -p $srcdir/$_gitname-build/lib/* "$pkgdir/usr/share/gnome-shell/js/" cp -pr "$srcdir/$_gitname-build/shellshape" \ "$pkgdir/usr/share/gnome-shell/extensions/shellshape@gfxmonk.net" cp -p $srcdir/$_gitname-build/icons/status/*.svg \ "$pkgdir/usr/share/icons/hicolor/scalable/status" cp -pr $srcdir/$_gitname-build/schemas \ "$pkgdir/usr/share/gnome-shell/extensions/shellshape@gfxmonk.net/schemas" }
true
2dec2bd29e92df516fe5e53b232c826848c05a03
Shell
ellinamorits/git-secret
/tests/test_hide.bats
UTF-8
880
3.21875
3
[]
no_license
#!/usr/bin/env bats load _test_base FILE_TO_HIDE="file_to_hide" FILE_CONTENTS="hidden content юникод" function setup { install_fixture_key "$TEST_DEFAULT_USER" set_state_git set_state_secret_init set_state_secret_tell "$TEST_DEFAULT_USER" set_state_secret_add "$FILE_TO_HIDE" "$FILE_CONTENTS" } function teardown { uninstall_fixture_key $TEST_DEFAULT_USER unset_current_state rm -f "$FILE_TO_HIDE" } @test "run 'hide' normally" { run git secret hide [ "$status" -eq 0 ] [ "$output" = "done. all 1 files are hidden." ] } @test "run 'hide' with params" { run git secret hide -v -c [ "$status" -eq 0 ] } @test "run 'hide' for multiple users" { local new_user="user2" install_fixture_key "$new_user" set_state_secret_tell "$new_user" run git secret hide [ "$status" -eq 0 ] [ "$output" = "done. all 1 files are hidden." ] }
true
fdd1f7c3e2bbe53c3a8e5d9687d5297bb05cce50
Shell
danbamboo/Bash-Shell-Script-and-Other-Linix-Programs-in-C
/DMStats
UTF-8
8,525
3.9375
4
[]
no_license
#!/bin/bash #PROGRAM 1 stats created by: Joseph McMurrough # For CS 344 @ OREGONSTATE UNIVERSITY #CALCULATES AVERAGES AND MEDIAN OF USER INPUT FILE/COMMAND LINE #USAGE: stats {-rows|-cols} [file] #---------------------------------- #1. SET TRAPS (get um) # We set traps in order to catch specifc signals that might get # triggered during execution, by user. Signals(Interrupt, hangup, terminate) #Checks for Signal: 1) Hang up 2) Interrupt 3) Terminate #---------------------------------- trap 'rm -f "$filewdata" "$sts" "$srt" "$coll" "$newrow"; echo "trap: Trap was set, temp files deleted." >&2;exit 1 ' HUP INT TERM KILL filewdata="datafile$$" #creates a string variable for file name with current #pid on the end. #CREATE TEMP FILES sts="tempStats$$" srt="tempSort$$" coll="tempCol$$" newrow="newrow$$" touch $filewdata touch $sts touch $srt touch $coll touch $newrow #---------------------------------- #1. CHECK ARGUMENTS #We start by checking to see if the number of arguments are correct. # If less than 1 (i.e 0) or greater than 2, produce Usage message and exit with error. #2. CREATE FILE || CHECK FOR VALID FILE # If only one argument user create data for file on the fly or #If two arguments check for valid file. #---------------------------------- if [[ $# -lt 1 ]]; then #if there are 0 arguments, display usage. echo "Usage: stats {-rows|-cols} [file]" >&2 #Output error message rm -f "$filewdata" "$sts" "$srt" "$coll" "$newrow" exit 1 #Exit program with error elif [[ $# -gt 2 ]]; then #if there are more than 2 arguments, display usage. echo "Usage: stats {-rows|-cols} [file]" >&2 rm -f "$filewdata" "$sts" "$srt" "$coll" "$newrow" exit 1 elif [[ $# -eq 1 ]]; then #if there is one argument, we need user input. cat > "$filewdata" #User input to filewdata file elif [[ $# -eq 2 ]]; then #Two arguments, check for valid file. if [[ -r $2 ]]; then #Check if file is readable #echo "File is good" #test for good file input cat $2 > "$filewdata" #cat file into our tempfile else #File was not readable, send error message, remove temp files, and exit w error echo "./stats: cannot read $2" >&2 rm -f "$filewdata" "$sts" "$srt" "$coll" "$newrow" exit 1 fi fi #---------------------------------- #1.CHECK VALID ROW/COL ARGUMENT # Now we have a valid file, or have created one, move on to check first input # for valid rows/columns argument, and execute steps based on that input. #2. EXECUTE #---------------------------------- #BY ROWS #---------------------------------- if [[ $1 == -r* ]]; then #First argument identified as rows #echo "computing by rows" echo -e "Average\tMedian" > $sts #Add header for rows stats display sum=0 while read lineByline do numOfnums=$(echo $lineByline | wc -w) #pipes output of current line into word count input, and counts number of numbers #Nested loop, loop though values on each line for num in $lineByline do sum=`expr $sum + $num` #Get the total of a row as you iterate though echo -e "$num" >> $srt done noRound=$(echo "scale=1; $sum/$numOfnums " | bc) #gives us unrounded number noRound=$(echo "scale=0; ($noRound+0.5)/1" | bc) #rounds number up if .5, down if <.5 echo -e -n "$noRound \t" >> $sts #Input average to sts file sort $srt -g -o $srt # sort with -o to indicate input file same as output -g numeric sorting medRow=`expr $numOfnums / 2 + 1` #Calc the middle value (or if even, the higher value) median=$(sed "${medRow}q;d" "$srt") #This sed function grabs the "medRow" numberth element out of file sort #Found this median solution here: http://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file echo "$median" >> $sts #Input median into sts files > $srt #Make file empty sum=0 #Set sum back to 0 for next row average calculation done < "$filewdata" #Get input of our temp file, read line by line cat $sts #DISPLAY RESULT TO USER #---------------------------------- #BY COLUMNS #---------------------------------- elif [[ $1 == -c* ]]; then #First argument identified as columns #echo "computing by columns" #test for correct funcationality fline=$(head -n 1 $filewdata) #get the first line of file to see how many columns numOfnums=$(echo $fline | wc -w) #calculate number of columns numofColplusone=`expr $numOfnums + 1` #numOflines=$(cat $filewdata | wc -l) #gets number of lines in file #CONVERT COLUMNS TO ROWS #This loop goes through the input file and converts the columns into rows, with #the resulting temp file #newrow i=1 #use i to grab the ith column out of input file (increment in loop below) while [ $i -lt $numofColplusone ] #Loop based on number of columns (plus one since we are starting index at 1 and saying less than #ofcolumns+1) do #Extract columns for file cut -f $i $filewdata >> $coll #get the ith column out of input file, put in coll cat $coll | tr '\n' '\t' >> $newrow #make a row out of those columns using the tr statement w/ tabs and newline echo "" >> $newrow > $coll i=`expr $i + 1` done #DO CALCS ON FILE (SAME AS ROW/USING TEMP FILE $newrow) #Changes input into temp file ($coll) after loops run so formated in a horizontal display. sum=0 #The sum varaible is used to grab a sum total of numbers in row/col while read lineByline do numOfnums=$(echo $lineByline | wc -w) #pipes output of current line into word count input, and counts number of numbers #Nested loop, loop though values on each line for num in $lineByline do sum=`expr $sum + $num` #Get the total of a row as you iterate though echo -e "$num" >> $srt done noRound=$(echo "scale=1; $sum/$numOfnums " | bc) #gives us unrounded number noRound=$(echo "scale=0; ($noRound+0.5)/1" | bc) #rounds number up if .5, down if <.5 echo -e -n "$noRound \t" >> $sts sort $srt -g -o $srt # sort with -o to indicate input file same as output -g numeric sorting medRow=`expr $numOfnums / 2 + 1` #Calc the middle value (or if even, the higher value) median=$(sed "${medRow}q;d" "$srt") #This sed function grabs the "medRow" numberth element out of file sort #Found this median solution here: http://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file echo "$median" >> $sts > $srt #Make file empty sum=0 #Set sum back to 0 for next row average calculation done < "$newrow" #Get input of our temp file, read line by line #GENERATE OUTPUT FILE IN NEW HORIZONTAL FORMAT: result is in $coll echo "Averages:" >> $coll #Averages header cut -f 1 $sts >> $srt #Get column one (averages), into temp file $srt cat $srt | tr '\n' '\t' >> $coll #convert column to row, input into $coll > $srt #clear srt file for next use echo >> $coll #andd new line at end of averages line echo "Medians:" >> $coll #Median header cut -f 2 $sts >> $srt #Get column 2 (medians), put in temp $srt cat $srt | tr '\n' '\t' >> $coll #Convert columns to row echo >> $coll #add new line cat $coll #DISPLAY RESULT TO USER #---------------------------------- #BAD INPUT FOR ARGUMENT 1 #---------------------------------- else echo "Usage: stats {-rows|-cols} [file]" >&2 if [[ -f "$filewdata" ]] then rm -f "$filewdata" "$sts" "$srt" "$coll" "$newrow" fi #We must remove temp files in this location, as they have been created now and we are exiting. exit 1 #Exit program with error fi #sleep 5; #used to test trap functionality #---------------------------------- #REMOVE TEMP FILES THAT WERE CREATED #(no trap set....yet :0) #---------------------------------- rm -f "$filewdata" "$sts" "$srt" "$coll" "$newrow"
true
830c1372c7a6bcaa7d9db18ac1218316a094df5b
Shell
n2burns/code
/videos/ls_vid_res.sh
UTF-8
755
4.21875
4
[]
no_license
#/bin/bash #ls_vid_res.sh #lists all video files (avi, mp4, mkv) in the input folder (and sub-folders) and uses mediainfo to give their vertical resolution #extended pattern matching shopt -s extglob function usage { echo "usage: $0 Dir" } if [ $# = 1 ]; then cd "$1" declare -r orgDir=`pwd` else usage exit 0 fi dir="$orgDir" function folders { #loop throgh video files for i in "$dir"/*.@(avi|mp4|mkv); do if [ -f "$i" ]; then echo $i height=`mediainfo "$i" | grep Height` height="${height//[!0-9]/}" echo $height fi done #loop through folders to find additional files to list/process for i in "$dir"/*; do if [ -d "$i" ]; then cd "$i" dir=`pwd` folders fi done } folders
true
d04d66d6755e8a702f7770d86a585ba4c6cc4d80
Shell
dhootha/Infimum-Linux
/scripts/stage1/util-linux.sh
UTF-8
392
3.078125
3
[]
no_license
VERSION=2.20 function _fetch() { wget -P$SRC -c # URL to fetch } function _prep() { tar -xvf $SRC/util-linux-$VERSION.tar.bz2 } function _build() { cd $BUILD/util-linux-$VERSION ./configure --prefix=/tools --disable-nls make $MAKE_FLAGS } function _install() { cd $BUILD/util-linux-$VERSION make $MAKE_INSTALL_FLAGS install } function _cleanup() { rm -Rf $BUILD/util-linux-$VERSION }
true
05ac46e12194c19626a78b14f4af21beedd4e520
Shell
Joshhua5/x265NetworkEncoder
/pass.sh
UTF-8
368
2.9375
3
[]
no_license
#! /bin/bash # Check for finished clients ./prepare_clients #Check/Wait for a avaliable Client cd enc_ftp/Clients #Cycle through all clients for dir in $(ls) do cd dir if ls done.txt then if ls tast.txt then # pass the file mv "$1" "$(basename $1)" "$1" | original_path.txt "$(basename $1)" | tast.txt exit fi fi cd .. done cd ../..
true
6f7bebaafa404f9284ecdc38c0bededc1de3997a
Shell
linuxdroid/mininix-packages
/packages/sl/build.sh
UTF-8
502
2.96875
3
[ "Apache-2.0" ]
permissive
MININIX_PKG_HOMEPAGE=https://github.com/mtoyoda/sl MININIX_PKG_DESCRIPTION="Tool curing your bad habit of mistyping" MININIX_PKG_VERSION=5.02 MININIX_PKG_REVISION=1 MININIX_PKG_SRCURL=https://github.com/mtoyoda/sl/archive/${MININIX_PKG_VERSION}.tar.gz MININIX_PKG_SHA256=1e5996757f879c81f202a18ad8e982195cf51c41727d3fea4af01fdcbbb5563a MININIX_PKG_DEPENDS="ncurses" MININIX_PKG_BUILD_IN_SRC=yes mininix_step_make_install () { install sl $MININIX_PREFIX/bin/ cp sl.1 $MININIX_PREFIX/share/man/man1 }
true
1bc6c17abd14dd77db60e08e13204e4ece0ff039
Shell
kira/ops-scripts
/sysctl/supervisord
UTF-8
886
3.84375
4
[]
no_license
#!/bin/sh # # /etc/rc.d/init.d/supervisord # chkconfig: - 64 36 # description: Supervisor Server # processname: supervisord # Source init functions . /etc/rc.d/init.d/functions prog="supervisord" prefix="/usr/" exec_prefix="\$prefix" prog_bin="\$exec_prefix/bin/supervisord" PIDFILE="/var/run/\$prog.pid" start() { echo -n \$"Starting \$prog: " daemon \$prog_bin --pidfile \$PIDFILE -c /etc/supervisor/supervisord.conf [ -f \$PIDFILE ] && success \$"\$prog startup" || failure \$"\$prog startup" echo } stop() { echo -n \$"Shutting down \$prog: " [ -f \$PIDFILE ] && killproc \$prog || success \$"\$prog shutdown" echo } case "\$1" in start) start ;; stop) stop ;; status) status \$prog ;; restart) stop start ;; *) echo "Usage: \$0 {start|stop|restart|status}" ;; esac
true
55082a369ea4451e9aad6bfa112e5b810a0ee45b
Shell
alisw/AliPhysics
/PWGLF/FORWARD/analysis2/sim/doit.sh
UTF-8
16,249
3.5
4
[]
permissive
#!/bin/bash version=6 tag= id= run= stage=0 upload=0 jobs=2 events=1 aliroot="v5-04-Rev-20" aliroot="v5-08-03a-5" aliroot="v5-08-00-1" AliPhysics="rel,normal,last" root="" geant="" minmerge=30 noact=0 inp= # --- Display help message ------------------------------------------- usage() { cat <<EOF Usage: $0 [OPTIONS] Options: -h,--help This help -t|--tag TAG Job tag [****] ($tag) -i|--id NAME Name of production ($id) -R|--run RUN_NO Run number ($run) -c|--copy Copy files to AliEn -n|--jobs JOBS Set number of jobs[**] ($jobs) -m|--events EVENTS Set events/job[**] ($events) -s|--stage STAGE Set the stage[***] ($stage) -o|--output DIR Set base output directory ($aout) -d|--data DIR Set data directory ($adir) -b|--bin DIR Set base bin directory ($abin) -a|--aliroot RELEASE Set AliROOT release [*] ($aliroot) -r|--root RELEASE Set ROOT release [*] ($root) -g|--geant RELEASE Set GEANT3 release [*] ($geant) -f|--final NUMBER Run final merging when down to this ($minmerge) -I|--input DIR Directory of production -x|--dry-run Just do a dry run -S|--stages STAGES What to merge [*] Only make sense with option -c [**] Only make sense for stage 0 [***] If stage is set to 6, try to deduce the stage automatically [****] TAG is a short hand for specific id and run EOF } # --- Process a return value ----------------------------------------- log_msg() { local log=$1 ; shift echo -en "$@\e[0m ... " if test "x$log" != "x" ; then echo "=== $@" >> $log fi } # --- Make error ----------------------------------------------------- log_err() { local pre=$1 local post=$2 echo -e "\e[31;1mError\e[0m: ${pre} \e[35m${post}\e[0m" > /dev/stderr } # --- Process a return value ----------------------------------------- log_end() { local log=$1 local ret=$2 local ext=$3 local msg="" local fmt="" if test $ret -eq 0 ; then msg="success" fmt="32" else msg="failure" fmt="31" fi echo -e "\e[${fmt}m${msg}${ext}\e[0m" if test "x$log" != "x" ; then echo "=== $msg$ext" >> $log fi } # --- Copy a file to AliEn ------------------------------------------- copy() { local file=$1 local dest=$2 local del=$3 local base=`basename $file` if test "x$del" != "x" ; then log_msg cp.log "Removing \e[33malien:${dest}/${base}" if test $noact -lt 1 ; then alien_rm ${dest}/${base} >> cp.log 2>&1 fi log_end cp.log $? " (ignore errors)" fi log_msg cp.log "Uploading \e[33m${file}\e[0m to \e[33m${dest}" if test $noact -lt 1 ; then alien_cp -n file:${file} alien:${dest}/${base} >> cp.log 2>&1 fi log_end cp.log $? } # --- Do a search ---------------------------------------------------- find() { local dir=$1 local pat=$2 local out=$3 local tmp=$4 local max=10000 log_msg "" "Searching \e[33m$dir\e[0m for \e[33m$pat" local nfiles=`alien_find "$dir" "$pat" | grep "files found"` local ret=$? if test $ret -ne 0 || test "x$nfiles" = "x" ; then log_end "" $ret "Not found" return 1 fi nfiles=`echo "$nfiles" | sed -e 's/^ *//' -e 's/ *files found//'` log_msg "" "\e[34m$nfiles" if test $nfiles -le $max ; then alien_find -x "$out" "$dir" "$pat" > $tmp 2> find.log ret=$? log_end "" $? " Got $nfiles in \e[33m${tmp}" return 0 fi o=0 rm -f find.log rm -f ${tmp}.tmp while test $o -lt $nfiles ; do let e=$o+$max log_msg "" "${o}" alien_find -l $max -o $o -x "$out" "$dir" "$pat" > ${tmp}.$o 2>>find.log ret=$? if test $ret -ne 0 ; then break; fi if test "x$o" = "x" ; then o=0 ; fi let p1=$o/10 let p2=$p1/10 let p3=$p2/10 let p4=$p3/10 if test $o -eq 0 ; then p1= p2= p3= fi # printf "%5d: %-16s '%-4s' '%-4s' '%-4s'\n" $o $i $p1 $p2 $p3 t=`basename $i .log`.tmp sed -e '/<?xml version="1.0"?>/d' \ -e '/<\/*alien>/d' \ -e '/<\/*collection.*/d' \ -e '/<info .*/d' \ -e '/^[[:space:]]*$/d' \ -e "s/event name=\"\([0-9][0-9][0-9][0-9]\)\"/event name=\"$p4\1\"/g" \ -e "s/event name=\"\([0-9][0-9][0-9]\)\"/event name=\"$p3\1\"/g" \ -e "s/event name=\"\([0-9][0-9]\)\"/event name=\"$p2\1\"/g" \ -e "s/event name=\"\([0-9]\)\"/event name=\"$p1\1\"/g" \ < ${tmp}.$o >> ${tmp}.tmp let o=$o+$max done if test $o -eq 0 ; then log_end "" 1 "No files found" return 1 fi sed -n -e '/<?xml.*?>/p' \ -e '/<alien>/p' \ -e '/<collection .*/p' \ < ${tmp}.0 > $tmp cat ${tmp}.tmp >> $tmp sed -n -e '/<info.*>/p' \ -e '/<\/alien>/p' \ -e '/<\/collection/p' \ < ${tmp}.0 >> $tmp log_end "" 0 " Got $nfiles ($o) in \e[33m${tmp}" } # --- Run merging jpb ------------------------------------------------ merge() { local what=$1 local stage=$2 local dir=$3 local aout=$4 local tag=$5 local run=$6 local tmpdir=`mktemp -d` local pre=$what local subs= if test "x$what" = "xAOD"; then # echo "AOD run $run pre=$pre sub=$sub" if test $stage -eq 1 ; then pre="aod" subs="AOD" else pre="AOD"; fi fi local out=${aout}/${tag}/${run} local top=${aout}/${tag}/${run} local bse=${what}_Stage_${stage}.xml local xml=${tmpdir}/${bse} local arc=${pre}_archive.zip local jdl=Merge.jdl local ret=0 if test "x$inp" != "x" ; then out=${inp}/${tag}/${run} fi rm -f cp.log if test $noact -gt 0 && test -f ${bse} ; then log_msg cp.log "Dummy XML from ${bse}" cp ${bse} ${xml} fi log_msg cp.log "Creating XML file" if test $stage -eq 1 ; then if test $noact -lt 1 || test ! -f $xml ; then rm -f ${xml} find ${out} ${sub}*/${arc} ${top}/${bse} ${xml} fi ret=$? else let prev=$stage-1 if test $noact -lt 1 || test ! -f $xml ; then rm -f ${xml} for sub in ${subs} "" ; do find ${top}/${what}_Stage_${prev} ${sub}*/${arc} \ ${top}/${bse} ${xml} if test -f ${xml} ; then break ; fi done fi ret=$? fi # log_end cp.log $ret if test $ret -ne 0 ; then log_err "Make XML", "Failed to make XML collection $bse" exit 1 fi local n=`grep "<event name" ${xml} | wc -l 2>/dev/null` if test $n -lt $minmerge ; then old=$bse stage=5 jdl=Final.jdl bse=${what}_Stage_${stage}.xml tmp=${tmpdir}/${bse} sed "s,$old,$bse," < $xml > $tmp xml=$tmp fi echo -e "\e[33m$n\e[0m input files for \e[32m${what} stage ${stage}\e[0m" if test $noact -lt 1 ; then alien_mkdir -p ${top} fi copy ${xml} ${top} del log_msg "" "Submitting merging job \e[33m${jdl}" if test $noact -lt 1 ; then alien_submit alien:${dir}/${jdl} ${run} ${stage} ${tag} ${what} else : #log_msg "" "alien_submit alien:${dir}/${jdl} ${run} ${stage} ${tag} ${what}" fi log_end "" $? } # --- Determine the next stage --------------------------------------- progress() { local aout=$1 local id=$2 local run=$3 local inp=$4 local what=$5 local out=${aout}/${id}/${run} local first=$out if test "x$inp" != "x" ; then first=${inp}/${id}/${run} fi local firsts="$first" case $what:$run in AOD:138190) ;; AOD:*) firsts="${first}/AOD $firsts";; *) ;; esac log_msg "" "Deduce next stage for \e[33m$out" # First, check for final merge result log_msg "" "\nCheck of \e[33m${out}/${what}_merge_archive.zip" alien_ls ${out}/${what}_merge_archive.zip > /dev/null 2>&1 if test $? -eq 0 ; then echo "Forcing 6" stage=6 else # Then check for production data firstFound=0 for f in $firsts ; do log_msg "" "\nCheck of \e[33m${f}/001" alien_ls ${f}/001 > /dev/null 2>&1 ret=$? # echo "ret=$ret" if test $ret -eq 0 ; then firstFound=1 fi done if test $firstFound -lt 1 ; then log_msg "\nNo production data, forcing 0" stage=0 else # Finally, check each merge stage tmp=0 stage=0 for i in 4 3 2 1; do log_msg "" "\nCheck of \e[33m${out}/${what}_Stage_${i}" alien_ls ${out}/${what}_Stage_${i} > /dev/null 2>&1 if test $? -ne 0 ; then tmp=$i else break fi done stage=$tmp fi fi log_msg "" "\e[34;m$stage" log_end "" 0 } # --- Upload files --------------------------------------------------- push() { local bin=$1 local data=$2 local out=$3 local epos=$4 local tmpdir=`mktemp -d` rm cp.log jdls="Run.jdl Merge.jdl Final.jdl" for i in $jdls ; do log_msg "" "Creating \e[33m${i}" sed -e "s|@out@|${out}|" \ -e "s|@data@|${data}|" \ -e "s|@bin@|${bin}|" \ -e "s|@aliphysics@|${AliPhysics}|" \ -e "s|@root@|${ROOT}|" \ -e "s|@geant@|${GEANT3}|" \ < ${i}.in > ${tmpdir}/${i} log_end "" $? done log_msg cp.log "Removing and re-creating \e[33m${data}" if test $noact -lt 1 ; then alien_rmdir ${data} >> cp.log 2>&1 alien_mkdir -p $data >> cp.log 2>&1 fi log_end cp.log $? local del=1 if test "X$bin" = "X$data" ; then del=0 ; fi copy run.sh $bin $del copy merge.sh $bin $del files="simrun.sh \ GRP.C \ Simulate.C \ Config.C \ BaseConfig.C \ EGConfig.C \ DetConfig.C \ OCDBConfig.C \ Reconstruct.C \ Check.C \ Tag.C \ QA.C \ QAConfig.C \ AOD.C \ AODConfig.C \ ${tmpdir}/Run.jdl \ ${tmpdir}/Merge.jdl \ ${tmpdir}/Final.jdl" if test $epos -gt 0 ; then files="$files $HOME/foo/EPOSLHC.tar.gz" fi for i in $files ; do copy $i ${data} done } # --- Make list of availabl packages --------------------------------- getAvailable() { wget -q http://alimonitor.cern.ch/packages/ -O - | \ sed -n -e '/<tr/,/<\/tr>/ p' | \ sed -n -e "/<a.*VO_ALICE@[-a-zA-Z0-9]\+::[-a-zA-Z0-9_]\+.*/,/^[[:space:]]*\(VO_ALICE@.*\|\)$/ p" | \ grep VO_ALICE | \ sed -e 's/^[[:space:]]\+<a.*VO_ALICE@/- VO_ALICE@/' -e 's/<\/a>//' | \ tr '\n' ' ' | \ sed 's/- /\n- /g' > .list } # --- Get package version -------------------------------------------- getVersion() { local pack=$1 local sel=$2 log_msg "" "Checking for version of $pack ($sel)" if test ! -f .list ; then getAvailable fi filt1=p case $sel in an*) filt1='s/vAN-\([^[:space:]]\+\)/vAN-\1/p' ;; rel*) filt1='s/v\([0-9]-[0-9]\{2\}-\)\(Rev\|[0-9]\{2\}[a-z]\?\)\([-_]TEST[a-zA-Z]*\|\)\([-0-9]*\)$/v\1\2\3\4/p' ;; all*) ;; esac filt2=p case $sel in *,normal*) filt2='/[^[:space:]]\+[-_]TEST[^[:space:]]*/d;p' ;; *,test*) filt2='s/\([^[:space:]]\+[-_]TEST[^[:space:]]*\)/\1/p';; esac filt3= filt4=cat case x$sel in x*list*|x*help*) filt3=cat ;; x*,last*) filt3="tail -n 1" ;; x*v*) v=`echo $sel | sed 's/.*\(v[-a-zA-Z0-9_]\+\).*/\1/'` filt3="grep $v" filt4="tail -n 1" ;; esac if test "X$filt3" = "X" ; then log_end "" 1 log_err "Get version of $pack: bad query $sel" exit 1 fi v=`cat .list | sed -n -e "s/^- VO_ALICE@${pack}::\([^[:space:]]\+\)[[:space:]]\+.*/\1/p" | sed -n $filt1 | sed -n $filt2 | $filt3 | $filt4` log_end "" $? " ($v)" eval `echo $pack=$v` } # --- Get package depdendencies -------------------------------------- getDependencies() { local pack=$1 local vers=$2 local dd=`cat .list | sed -n -e "s/^- VO_ALICE@${pack}::${vers}[[:space:]]\+//p"| tr ',' ' '` local d=$dd for i in $d ; do local p=`echo $i | sed -e 's/.*@//' -e 's/::.*//'` local v=`echo $i | sed -e 's/.*:://'` getDependencies $p $v local ep=`echo ${p} | tr '-' '_'` local ed=`echo ${ep}_d` eval pd=\$${ed} for j in $pd ; do if ! grep -q "$j"<<<${dd} ; then dd="$dd $j" fi done # echo "$p version $v $pd" # dd="$dd $pd" done local escp=`echo ${pack} |tr '-' '_'` # echo "Escaped: $escp - $dd" eval ${escp}_d=\"$dd\" } # --- Get package versions ------------------------------------------- getVersions() { getVersion AliPhysics "$1" getDependencies AliPhysics $AliPhysics echo "Version of AliPhysics: $AliPhysics" echo "Dependencies" for i in $AliPhysics_d ; do local p=`echo $i | sed -e 's/.*@//' -e 's/::.*//'` local v=`echo $i | sed -e 's/.*:://'` printf " %30s: %s\n" $p $v done } # --- Create an arcive for upload ------------------------------------ archive() { log_msg "" "Creating archive of files" local name=sim_files${version} mkdir -p ${name} files="\ run.sh \ AOD.C \ Check.C \ Config.C \ BaseConfig.C \ DetConfig.C \ EGConfig.C \ doit.sh \ Final.jdl.in \ GRP.C \ Merge.jdl.in \ QA.C \ README.md \ Reconstruct.C \ Run.jdl.in \ simrun.sh \ Simulate.C \ Tag.C \ merge.sh" for i in $files ; do cp $i ${name}/$i done tar -czf ${name}.tar.gz ${name} ret=$? rm -rf ${name} log_end "" $ret } # --- Set some variables --------------------------------------------- auid=`alien_whoami | sed 's/^ *//'` ahome=/alice/cern.ch/user/`echo $auid | sed 's/^\(.\).*/\1/'`/$auid adir=${ahome}/mc abin=${ahome}/mc aout=${ahome}/test stages="AOD QA" # --- Proces command line options ------------------------------------ while test $# -gt 0 ; do case $1 in -h|--help) usage; exit 0;; -t|--tag) tag=$2 ; shift ;; -i|--id) id=$2 ; shift ;; -R|--run) run=$2 ; shift ;; -c|--copy) upload=1 ;; -n|--jobs) jobs=$2 ; shift ;; -m|--events) events=$2 ; shift ;; -s|--stage) stage=$2 ; shift ;; -S|--stages) stages=$2 ; shift ;; -b|--bin) abin=$2 ; shift ;; -o|--output) aout=$2 ; shift ;; -d|--data) adir=$2 ; shift ;; -a|--aliroot) aliroot=$2 ; shift ;; -r|--root) root=$2 ; shift ;; -g|--geant) geant=$2 ; shift ;; -f|--final) minmerge=$2 ; shift ;; -A|--archive) archive ; exit 0 ;; -x|--dry-run|--no-act) noact=1 ;; -I|--input) inp=$2 ; shift ;; --) shift ; break ;; *) log_err "Unknown option" "$1" ; exit 1 ;; esac shift done abin=$adir opt=0 extra="" if test $# -gt 0 ; then opt="$1" shift fi epos=0 if [[ $opt =~ "process:epos-lhc" ]] ; then echo "We have EPOS-LHC" extra=",\"LF:${adir}/EPOSLHC.tar.gz\"" epos=1 fi # --- May upload only ------------------------------------------------ if test $upload -gt 0 ; then getVersions "$AliPhysics" push ${abin} ${adir} ${aout} ${epos} if test $stage -lt 0 ; then exit 0 fi fi # --- Inspect options ------------------------------------------------ case $tag in pp) id=$tag ; run=118506 ;; PbPb) id=$tag ; run=138190 ;; pPb) id=$tag ; run=195483 ;; Pbp) id=$tag ; run=196433 ;; esac if test "x$id" = "x" ; then log_err "" "No job identifier given" log_end "" 1 exit 1 fi if test "x$run" = "x" ; then log_err "" "No run number given" log_end "" 1 exit 1 fi case $stage in 0|1|2|3|4|5) : ;; 6) if test "x$stages" = "x" ; then echo "No stages to check" exit 1 fi for s in $stages ; do progress "$aout" "$id" "$run" "$inp" "$s" done ;; *) log_err "Invalid stage" "$stage" ; exit 1 ;; esac if test $stage -ge 6 ; then log_msg "" "All done" log_end "" 0 exit 0 fi # --- Either run the job or merge ------------------------------------ if test $stage -le 0 ; then log_msg "" "Removing old ${aout}/${id}/${run}" ret=0 if test $noact -lt 1 ; then alien_rmdir ${aout}/${id}/${run} > /dev/null 2>&1 ret=$? fi log_end "" $ret " (ignore errors)" log_msg "" "Submitting \e[33mRun.jdl\e[0m for \e[34m$id $run\e[0m (\e[34m$jobs\e[0m jobs w/\e[34m$events\e[0m) additional options \e[34m$opt\e[0m and extras \e[34m$extra\e[0m\n" if test $noact -lt 1 ; then alien_submit alien:${adir}/Run.jdl \ ${run} ${jobs} ${events} ${id} "$opt" "$extra" ret=$? else echo "alien_submit alien:${adir}/Run.jdl ${run} ${jobs} ${events} ${id} \"$opt\" \"$extra\"" fi log_end "" $ret exit $ret fi for s in $stages ; do merge ${s} ${stage} ${adir} ${aout} ${id} ${run} done # # EOF #
true
17945c3140c0bb4d3b47d2e68d7b1491920b7011
Shell
DimetrikusK/Docker
/01_dockerfiles/ex01/run.sh
UTF-8
331
2.734375
3
[]
no_license
#!/bin/sh docker build -t ex01 . docker run -d --name teamspeak --rm -p 9987:9987/udp -p 10011:10011 -p 30033:30033 ex01 echo "Server is running. Connect with local client to $(ipconfig getifaddr en0)." echo "When finished, run \`docker stop teamspeak\`" echo "Password:" $(docker logs teamspeak | grep token | awk '{print $5}')
true
740031e461bf8a5fb56d8aa3bdf05fe617ade6de
Shell
CXH-8300/Username
/username.sh
UTF-8
472
3.828125
4
[]
no_license
#!/bin/sh #USERNAME. SIZE="$[ 1 + $[ RANDOM % 4 ]]" ORDEROFMAGNITUDE="$[ 1 + $[ RANDOM % 4 ]]" #grab some random bytes and convert. trim to only desired output characters. #and then take only what was decided. PREFIX=$(dd if=/dev/urandom bs=1024 count=1|base64 |tr -dc 'A-Z'|head -c $SIZE) POSTFIX=$(dd if=/dev/urandom bs=1024 count=1|base64 |tr -dc '0-9'|head -c $ORDEROFMAGNITUDE) #clear base64's output and construct USERNAME. clear && echo "$PREFIX-${POSTFIX}00"
true