Skip to content

Commit

Permalink
copy over all links
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanm0 committed Oct 4, 2024
1 parent 01f0a14 commit c838a58
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 0 deletions.
1 change: 1 addition & 0 deletions access/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://forms.gle/uVMfF9vDrhm9CvuV9'" />
1 change: 1 addition & 0 deletions accessrequests/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://docs.google.com/spreadsheets/d/10mSEU2_Bde-GKG4U9_7antTpo6prCla46O4PJ-404yw/edit'" />
1 change: 1 addition & 0 deletions budget/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://docs.google.com/spreadsheets/d/10zmXXo8Z4qHoHjVYKDl0H2SDKE3P1C_sDL9I1cn3qgU/edit'" />
1 change: 1 addition & 0 deletions bulk/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://docs.google.com/forms/d/e/1FAIpQLScoKre7VhIK189h73gvhl0p8X69qG7PzpS6_FWlnbWbNbwz6Q/viewform'" />
1 change: 1 addition & 0 deletions buy/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://docs.google.com/forms/d/e/1FAIpQLSfmPC8OxLRwt7R16fbjaZ6Zpnjxt3SyY5FyRDOcJiye0jRrCQ/viewform'" />
1 change: 1 addition & 0 deletions cal/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='/calendar'" />
1 change: 1 addition & 0 deletions calendar/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://calendar.google.com/calendar/u/0?cid=Y18zNjVjNDFkZTMwMzJjNjNjZmEzY2M5NzMyMWUzMDNhZTRiNGJkNmJkMTA4MjZkOTk4NjI3YzZhM2JhYzM5MjAwQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20'" />
1 change: 1 addition & 0 deletions discord/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://discord.gg/PmnBAkCnHc'" />
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://drive.google.com/drive/u/0/folders/1LkxtBDDM4HcmJq-8cBNwbUXOj4awXsgB'" />
1 change: 1 addition & 0 deletions drive/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://drive.google.com/drive/u/0/folders/0AEaWmt_2rZslUk9PVA'" />
116 changes: 116 additions & 0 deletions edit_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Importing necessary modules
import argparse
import sys
import os

if len(sys.argv) < 2:
print("usage: python edit_links.py <action> <short> [long] [description]")
sys.exit(1)

# use argparse to get an add/del argument, a short, long, and description argument for add, and a short argument for del
parser = argparse.ArgumentParser()
parser.add_argument("action", help="add or del")
parser.add_argument("short", help="short link to add or delete")
parser.add_argument(
"long",
help="full url of the link, required if adding",
nargs="?" if sys.argv[1] == "del" else 1,
)
parser.add_argument(
"description",
help="description of the link, required if adding",
nargs="?" if sys.argv[1] == "del" else 1,
)
args = parser.parse_args()

# Checking if the user wants to add a new link
if args.action == "add":
# Checking if the user has provided all the required arguments
# if len(sys.argv) != 5:
# print("usage: python edit_links.py add <short> <long> <description>")
# sys.exit(1)

# Assigning the arguments to variables
short = args.short
long = args.long[0]
description = args.description[0]

# Generating the HTML code for the redirect
html = '<meta http-equiv="Refresh" content="0; url=\'' + long + "'\" />"

# Checking if the link already exists
if short in os.listdir("."):
print("Error: link '" + short + "' already exists")
sys.exit(1)

# Creating a new folder with the short name and adding an index.html file inside containing the HTML code
os.mkdir(short)
f = open(short + "/index.html", "w")
f.write(html)
f.close()

# Adding the new link to the jmp/index.html table
f = open("index.html", "r")
lines = f.readlines()
f.close()
f = open("index.html", "w")
for line in lines:
# Checking if the line contains the end of the table
if "</table>" in line:
# Adding the new link to the table
f.write(
" <tr>\n"
+ ' <th><a href="../'
+ short
+ '">'
+ short
+ "</a></th>\n"
+ " <td>"
+ description
+ "</td>\n"
+ " </tr>\n"
)
f.write(line)
f.close()

# Checking if the user wants to delete a link
elif args.action == "del":
# Checking if the user has provided all the required arguments
# if len(sys.argv) != 3:
# print("usage: python edit_links.py del <short>")
# sys.exit(1)

# Assigning the arguments to variables
short = args.short

# delete folder with [short] name if it exists
try:
os.remove(short + "/index.html")
os.rmdir(short)
except FileNotFoundError:
print("Error: link '" + short + "' does not exist")
sys.exit(1)

# delete link from jmp/index.html table
f = open("index.html", "r")
lines = f.readlines()
f.close()
f = open("index.html", "w")

# parse through lines and delete the <tr> with the link
linenum = 0
for i, line in enumerate(lines):
# if currently on one of the lines of the <tr> with the link, skip it
if linenum > 0 and linenum < 4:
linenum += 1
# if the next line has the link, the current line is the beginning of the relevant <tr>
elif (
i < len(lines) - 1
and '<th><a href="../' + short + '">' + short + "</a></th>" in lines[i + 1]
):
linenum = 1
# if the next line does not have the link or the current line is after the last line of the <tr> to be deleted, write the current line
else:
linenum = 0
f.write(line)
f.close()
Binary file added favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions github/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://github.com/autoslug/'" />
89 changes: 89 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>

<head>
<title>autoslug jmp</title>
<meta charset="utf-8">
<link rel="icon" href="favicon.png" type="image/x-icon">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>

<body>
<h1>autoslug jmp (jump) links</h1>
<table id="sortTable">
<tr>
<th><a href="budget">budget</a></th>
<td>2023-2024 budget</td>
</tr>
<tr>
<th><a href="buy">buy</a></th>
<td>2023-2024 purchase request form</td>
</tr>
<tr>
<th><a href="calendar">calendar</a></th>
<td>events/meetings calendar</td>
</tr>
<tr>
<th><a href="discord">discord</a></th>
<td>discord invite link</td>
</tr>
<tr>
<th><a href="drive">drive</a></th>
<td>google drive</td>
</tr>
<tr>
<th><a href="github">github</a></th>
<td>github org</td>
</tr>
<tr>
<th><a href="instagram">instagram</a></th>
<td>instagram account</td>
</tr>
<tr>
<th><a href="onshape">onshape</a></th>
<td>OnShape team</td>
</tr>
<tr>
<th><a href="purchases">purchases</a></th>
<td>2023-2024 purchase requests</td>
</tr>
<tr>
<th><a href="roster">roster</a></th>
<td>2023-2024 roster form</td>
</tr>
<!-- <tr>
<th><a href="trello">trello</a></th>
<td>trello workspace/boards</td>
</tr> -->
<tr>
<th><a href="cal">cal</a></th>
<td>redirect to calendar</td>
</tr>
<tr>
<th><a href="docs">docs</a></th>
<td>drive folder for documentation</td>
</tr>
<tr>
<th><a href="access">access</a></th>
<td>access request form</td>
</tr>
<tr>
<th><a href="accessrequests">accessrequests</a></th>
<td>access request form responses</td>
</tr>
<tr>
<th><a href="bulk">bulk</a></th>
<td>2023-2024 bulk purchase request form</td>
</tr>
</table>
<script>
var mylist = $('#sortTable');
var listitems = mylist.find('tr');
listitems.sort(function (a, b) {
return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
})
$.each(listitems, function (idx, itm) { mylist.append(itm); });
</script>
</body>

</html>
1 change: 1 addition & 0 deletions instagram/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://www.instagram.com/autoslug.ucsc/'" />
1 change: 1 addition & 0 deletions onshape/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://cad.onshape.com/documents/t/646a95cdad68b5352342ae51'" />
1 change: 1 addition & 0 deletions purchases/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://docs.google.com/spreadsheets/d/1sPlOOzcZ9ZBsyIGa2sg6iAZjffJizO9V3_mKMvhmKIA/edit'" />
1 change: 1 addition & 0 deletions roster/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://docs.google.com/forms/d/e/1FAIpQLSfcXc5srn6ffk2zCsvuDsCDJjAvC25yKEWCee7Z_9I9nBUOMA/viewform'" />
1 change: 1 addition & 0 deletions trello/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://trello.com/w/autoslug'" />

0 comments on commit c838a58

Please sign in to comment.