Skip to content

Instantly share code, notes, and snippets.

View TheGarkine's full-sized avatar

Raphael Krauthann TheGarkine

View GitHub Profile
@TheGarkine
TheGarkine / gdrive-upload-workflow.yaml
Created April 11, 2022 17:15
A Short GitHub Actions workflow to build my CVs and push them to one Drive
name: Build CVs
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
File: [CV_Raphael_Krauthann, Lebenslauf_Raphael_Krauthann]
steps:
- name: Check out repository
@TheGarkine
TheGarkine / gdrive-upload-script.py
Created April 11, 2022 16:58
A longer and typed version of the Google Drive Upload Script in Python.
#!/usr/bin/python3
from collections import namedtuple
from typing import List, Optional
import argparse
import magic
from googleapiclient.discovery import build, Resource
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient.http import MediaFileUpload
@TheGarkine
TheGarkine / gdrive-upload-simple.py
Last active April 11, 2022 16:56
A minimal working example that uploads a given file to Google Drive
import magic
from googleapiclient.discovery import build, Resource
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient.http import MediaFileUpload
FOLDER_ID = "<your google drive folder id>"
FILE_NAME = "CV.pdf" # How you want your file to be named in Google Drive
FILE_LOCATION = "./CV.pdf"
# Use your JSON token to create the Google Drive Service with it
@TheGarkine
TheGarkine / gdrive-upload-requirements.txt
Created April 11, 2022 16:11
Google Drive Upload Python Packages
python-magic==0.4.25
oauth2client==4.1.3
google-api-python-client==2.43.0
httplib2>=0.15.0
const form = document.getElementById("contactForm");
if (request.status === 200) {
// Freeze the form
document.getElementById("contactEmail").readOnly = true;
document.getElementById("contactMessage").readOnly = true;
document.getElementById("contactSubmit").disabled = true;
// Append a thank you message
const span = document.createElement("span");
const email = document.getElementById("contactEmail").value;
const message = document.getElementById("contactMessage").value;
const text = encodeURIComponent(`Email: ${email}\n\n---Message below---\n${message}`);
const url = `https://api.telegram.org/bot${botApiKey}/sendMessage?chat_id=${chatID}&text=${text}`;
const request = new XMLHttpRequest();
request.open( "GET", url, false ); // false for synchronous request
request.send();
<form id="contactForm">
<div class="form-group">
<label for="contactEmail">Email address</label>
<input type="email" class="form-control" id="contactEmail" aria-describedby="emailHelp" placeholder="Enter email" required>
<small class="form-text text-muted">I'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="contactMessage">Message</label>
<textarea class="form-control" id="contactMessage" rows="3" required></textarea>
</div>