Initial set of scripts

This commit is contained in:
silvernode 2015-08-08 21:04:55 -07:00
parent 362f74cd7e
commit 4f119844fd
21 changed files with 577 additions and 0 deletions

53
Bash Scripts/adduser.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
Create_user(){
echo
echo -n "Username: "
read uname
useradd -m -G wheel,storage,audio,video,optical,lp,network,dbus,xbuilder -s /bin/bash ${uname}
echo
if [ -d /home/${uname} ];then
echo "User ${uname} created"
else
echo "User creation failed"
fi
}
Remove_user(){
echo
echo -n "Username to delete: "
read duser
userdel ${duser}
if [ -d /home/${duser} ];then
rm -R /home/${duser}
else
echo "User creation failed"
fi
}
main(){
while true;do
clear
echo
echo "[1] - Add User"
echo "[2] - Remove User"
echo
echo -n "Choose: "
read choice
if [ "${choice}" = "1" ];then
Create_user
else
echo "no"
fi
done
}
Create_user

11
Bash Scripts/backity/config.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
#=====| General Options |======#
#default directory to backup
DEFAULTDIR="/home/${USER}"
BACKUPNAME="$(date +"%m_%d_%Y")"
#======| Network Options |=====#
PROTOCOL=
SERVERNAME=""

28
Bash Scripts/ddstatus.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
PID=$(pidof dd)
main(){
while true;do
clear
if [ ! ${PID} ];then
echo "DD is not running"
exit 0;
elif [[ ${PID} ]];then
kill -USR1 ${PID} > /dev/null
sleep 1
if [[ ! ${PID} ]];then
echo "dd it no longer running"
exit 0;
fi
else
echo "There was an unknown error, exiting..."
exit 0;
fi
done
}
main

31
Bash Scripts/format-buddy.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
while [ 1=1 ];do
clear
echo "[1] - Format device as Fat32"
echo
echo -n ">>: "
read choice
if [ "$choice" = "1" ];then
echo
lsblk
echo
echo -n "Type full path to device (/dev/xx1): "
read device
mkfs.fat -F32 -v -l -n $device
else
echo "Fuck....."
fi
done

8
Bash Scripts/fuck.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
echo "fuck"
ass(){
echo "gayness"
}

19
Bash Scripts/func_test.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
testingpoo(){
if [ $1 -gt $2 ];then
echo "$1 is greater than $2"
elif [ $1 -lt $2 ];then
echo "$1 is less than $2"
elif [ $1 -eq $2 ];then
echo "$1 is equal to $2"
else
echo "Fuck you"
fi
}
testingpoo $1 $2

102
Bash Scripts/julia-installer.sh Executable file
View File

@ -0,0 +1,102 @@
#!/bin/bash
VERSION="0.3.8"
DOWN_DIR="/tmp"
ARC=$(getconf LONG_BIT)
PACKAGE64="julia-${VERSION}-linux-x86_64.tar.gz"
PACKAGE32="julia-${VERSION}-linux-i686.tar.gz"
if [[ $EUID -ne 0 ]]; then
echo "You are not root!" 1>&2
exit 1
fi
downLoad()
{
if [ $ARC = "64" ];then
wget https://julialang.s3.amazonaws.com/bin/linux/x64/0.3/julia-${VERSION}-linux-x86_64.tar.gz -P ${DOWN_DIR}
elif [ $ARC = "32" ];then
wget https://julialang.s3.amazonaws.com/bin/linux/x86/0.3/julia-${VERSION}-linux-i686.tar.gz -P ${DOWN_DIR}
fi
}
extrPack()
{
if [ -f ${DOWN_DIR}/${PACKAGE64} ];then
tar xvzf ${DOWN_DIR}/${PACKAGE64} -C ${DOWN_DIR}
elif [ -f ${DOWN_DIR}/${PACKAGE32} ];then
tar xvzf ${DOWN_DIR}/${PACKAGE32} - C ${DOWN_DIR}
fi
}
installJulia()
{
cd ${DOWN_DIR}/julia-79599ada44
cp -v -R bin/* /usr/bin/
cp -v -R etc/* /etc/
echo "hi"
cp -v -R include/* /include/
cp -v -R lib/* /lib
cp -v -R share/* /usr/share
cd ${DOWN_DIR}/julia-79599ada44
cp -v -R bin/* /usr/bin/
cp -v -R etc/* /etc/
cp -v -R include/* /include/
cp -v -R lib/* /lib
cp -v -R share/* /usr/share
}
removeJulia()
{
rm -v -R /usr/bin/julia
rm -v -R /usr/bin/julia-debug
rm -v -R /usr/include/julia
rm -v -R /usr/lib/julia
rm -v -R /etc/julia
rm -v -R /usr/share/julia
}
main()
{
clear
echo "=========================="
echo " JULIA INSTALLER"
echo "=========================="
echo
echo "[1] - Install"
echo "[2] - Remove"
echo
echo "[q] - Quit"
echo
echo -n "-> "
read choice
if [ ${choice} = "1" ];then
downLoad
extrPack
installJulia
echo
echo -n "Would you like to run Julia now (y/n)?: "
read runjul
if [ ${runjul} = "y" ];then
julia
exit 0;
elif [ ${runjul} = "n" ];then
exit 0;
fi
elif [ ${choice} = "2" ];then
removeJulia
exit 0;
elif [ ${choice} = "q" ];then
exit 0;
fi
}
main

169
Bash Scripts/sc.sh Executable file
View File

@ -0,0 +1,169 @@
#!/bin/bash
# SC - Service Commander - frontend for the sv command
###############################################################################################
## Copyright (c) 2015, Justin Moore
##
## Permission to use, copy, modify, and/or distribute this software
## for any purpose with or without fee is hereby granted,
## provided that the above copyright notice and this permission notice appear in all copies.
##
## THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
## WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
## AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
## OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
##############################################################################################
case $1 in
link | --link-service )
ln -v -s /etc/sv/$2 /var/service/
;;
unlink | --remove-service )
rm -v /var/service/$2
;;
linked | --linked-services )
cd /etc/sv && find -xtype l -exec ls -l {} \;
;;
list | ls | --list )
echo
echo -e "\e[92m Contents of /etc/sv/\e[0m"
#echo "Contents of /etc/sv/"
echo
ls /etc/sv
echo
echo -e "\e[96m Contents of /var/service/\e[0m"
echo
ls /var/service
echo
;;
up )
sv s /var/service/*
;;
start )
sv start $2
;;
restart )
sv restart $2
;;
stop )
sv stop $2
;;
--help | -h | help )
echo
echo " sc - Service Commander - frontend for the sv command"
echo
echo " Usage: sc link | unlink | linked | list | up | start | restart | stop <service>"
echo
echo
echo " For detailed help, see the commands below:"
echo
echo
echo " help-all"
echo " help-link"
echo " help-unlink"
echo " help-linked"
echo " help-list"
echo " help-up"
echo " help-start"
echo " help-restart"
echo " help-stop"
echo
;;
help-link )
echo
echo "link : Creates a symlink from /etc/sv/<name> -> /var/service/<name>"
echo
;;
help-unlink )
echo
echo "unlink : Removes symlink from /etc/sv/<name> -> /var/service/<name>"
echo
;;
help-linked )
echo
echo "linked : Lists all symlinked items in /etc/sv"
echo
;;
help-list )
echo
echo "list : List the contents of /etc/sv and /var/service"
echo
;;
help-up )
echo
echo "up : Lists all currently running services"
echo
;;
help-start )
echo
echo "start : Uses the 'sv' command to start a service"
echo
;;
help-restart )
echo
echo "restart : Uses the 'sv' command to restart a service"
echo
;;
help-stop )
echo
echo "stop : Uses the 'sv' command to stop a service"
echo
;;
help-all )
echo
echo "link : Creates a symlink from /etc/sv/<name> -> /var/service/<name>"
echo "unlink : Removes symlink from /etc/sv/<name> -> /var/service/<name>"
echo "linked : Lists all symlinked items in /etc/sv"
echo "list : List the contents of /etc/sv and /var/service"
echo "up : Lists all currently running services"
echo "start : Uses the 'sv' command to start a service"
echo "restart : Uses the 'sv' command to restart a service"
echo "stop : Uses the 'sv' command to stop a service"
echo
;;
*)
echo
echo " sc - Service Commander - frontend for the sv command"
echo
echo " Usage: sc link | unlink | linked | list | up | start | restart | stop <service>"
echo
echo
echo " For detailed help, see the commands below:"
echo
echo
echo " help-all"
echo " help-link"
echo " help-unlink"
echo " help-linked"
echo " help-list"
echo " help-up"
echo " help-start"
echo " help-restart"
echo " help-stop"
echo
;;
esac

12
Bash Scripts/status-test.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
xbps-install -Su
if [ $? = 0 ];then
echo "Success!"
elif [ $? = 1 ];then
echo "Nothing to see here"
fi

15
C files/99bottles Executable file
View File

@ -0,0 +1,15 @@
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
unsigned int bottles = 99;
do
{
printf("%u bottles of beer on the wall\n", bottles);
printf("%u bottles of beer\n", bottles);
printf("Take one down, pass it around\n");
printf("%u bottles of beer on the wall\n\n", --bottles);
} while(bottles > 0);
return EXIT_SUCCESS;
}

15
C files/99bottles.c Executable file
View File

@ -0,0 +1,15 @@
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
unsigned int bottles = 99;
do
{
printf("%u bottles of beer on the wall\n", bottles);
printf("%u bottles of beer\n", bottles);
printf("Take one down, pass it around\n");
printf("%u bottles of beer on the wall\n\n", --bottles);
} while(bottles > 0);
return EXIT_SUCCESS;
}

BIN
C files/a.out Executable file

Binary file not shown.

BIN
C files/strings Executable file

Binary file not shown.

22
C files/strings-and-if-else.c Executable file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include <string.h>
int main() {
char * name = "nigger";
int age = 28;
printf("%s, is you\n",name);
//use strncmp function from string.h to compare strings
//the number 3 is the length of fag
if ( strncmp(name, "fag", 3) == 0 ) {
printf("This fag is identified and is %d\n", age);
}
else if (strncmp(name, "nigger", 6) == 0){
printf("you are a %s\n", name);
}
else {
printf("I don't know you\n");
}
return 0;
}

7
Julia Scripts/100doors.jl Executable file
View File

@ -0,0 +1,7 @@
doors = falses(100)
for a = 1:100, b in a:a:100
doors[b] = !doors[b]
end
for a = 1:100
println("Door $a is " * (doors[a] ? "open" : "close"))
end

9
Julia Scripts/hello.jl Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/julia
function gayness()
println("Loser")
end
gayness()

42
Julia Scripts/high-low.jl Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/julia
die1=rand(1:100)
function input(prompt::String="")
print(prompt)
chomp(readline())
end
while true
choice = input("Guess a number 1-100: " )
if Base.isdigit(choice)
choice = parseint(choice)
else
println("$choice, is not a positive number")
continue
end
if choice < 101
if choice == die1
println("You win!")
return false
elseif choice > die1
println("Too high!")
elseif choice < die1
println("Too low!")
end
else
println(choice, " is greater than 100!")
end
end

31
Julia Scripts/putitoff.jl Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/julia
function input(prompt::String="")
print(prompt)
chomp(readline())
end
function main()
list = {}
while true
date = input("Type date: ");
addItem = input("Add an item: ")
together = "$addItem-$date"
push!(list,together)
println(list)
end
end
main()

1
Ruby Scripts/hello.rb Executable file
View File

@ -0,0 +1 @@
puts 'Hello, world!'

1
high-low-julia Submodule

@ -0,0 +1 @@
Subproject commit 7711c9559c7dcc7d47befbde38ab34ce3dfbfb90

1
julia-installer Submodule

@ -0,0 +1 @@
Subproject commit 44bade5361132394073198e02e3a488964db6dfa