Skip to content

Instantly share code, notes, and snippets.

View loftwah's full-sized avatar
💭
“Any sufficiently advanced technology is equivalent to magic.”

Dean Lofts loftwah

💭
“Any sufficiently advanced technology is equivalent to magic.”
View GitHub Profile
Gotta have a Gist hey?
www.facebook.com/loftwah
@loftwah
loftwah / curl.md
Created July 10, 2019 03:18 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

def postdata(self, resource, source):
self.authorize()
token = self.token
headers = {'Authorization': 'rocketskates ' + token}
logger.debug(source)
fin = open(source, 'rb')
files = {'file': fin}
session = requests.session()
session.auth = ('rocketskates', 'r0cketsk8ts')
#curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: multipart/form-data" -F "file=@[filepath]/[filename]" --insecure https://[endpoint url]/api/v3/isos/[filename]
import requests
import urllib3
from requests.auth import HTTPBasicAuth
import pysnooper
@pysnooper.snoop()
def main():
urllib3.disable_warnings()
url = "https://172.20.0.3:8092/api/v3/isos/CentOS-7-x86_64-Minimal-1810"
file = "CentOS-7-x86_64-Minimal-1810.iso"
@loftwah
loftwah / googlesheets.gs
Last active August 31, 2019 11:16
Send a PDF attachment in an email using GMail, with a document generated with a Docs template and a Google Sheet
//this is a function that fires when the webapp receives a GET request
function doGet(e) {
return HtmlService.createHtmlOutput("request received");
}
//this is a function that fires when the webapp receives a POST request
function doPost(e) {
var params = JSON.stringify(e.postData.contents);
params = JSON.parse(params);
var myData = JSON.parse(e.postData.contents);
@loftwah
loftwah / cloudSettings
Last active December 4, 2019 03:26
Settings for VScode - Linux
{"lastUpload":"2019-12-04T03:26:15.197Z","extensionVersion":"v3.4.3"}
@loftwah
loftwah / cloudSettings
Last active January 17, 2020 03:13
Settings for VScode Windows
{"lastUpload":"2020-01-17T03:13:34.438Z","extensionVersion":"v3.4.3"}
@loftwah
loftwah / webdev_online_resources.md
Created November 28, 2019 07:02 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@loftwah
loftwah / mongodb_cheat_sheet.md
Created November 28, 2019 07:02 — forked from bradtraversy/mongodb_cheat_sheet.md
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@loftwah
loftwah / github_gpg_key.md
Created November 28, 2019 07:02 — forked from ankurk91/github_gpg_key.md
Github : Signing commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/