Skip to content

Instantly share code, notes, and snippets.

@Midnex
Midnex / assetsByCategory.py
Last active December 4, 2021 17:54
Get the number of Deployableassets in SnipeIT
import json
from collections import Counter
import requests as req
SNIPE_HEADER = {
"Accept": "application/json",
"Authorization": "Bearer ", # after ther space in "Bearer " paste your API key
}
@Midnex
Midnex / snipeit.sh
Created September 1, 2021 22:24
Snipe-IT Install script Mint and Pop support.
#!/bin/bash
#/ Usage: snipeit.sh [-vh]
#/
#/ Install Snipe-IT open source asset management.
#/
#/ OPTIONS:
#/ -v | --verbose Enable verbose output.
#/ -h | --help Show this message.
# Added Pop!_OS and Mint to the install script.
@Midnex
Midnex / app.py
Created June 30, 2021 23:13
Example of PyAutoGUI
import pyautogui
pyautogui.click(1059, 217)
pyautogui.sleep(1)
pyautogui.write('data to find', interval=0.1)
pyautogui.sleep(1)
pyautogui.press('tab')
pyautogui.press('space')
# Show Table
@Midnex
Midnex / data.py
Created June 12, 2021 18:47
Build a Quiz Application in Python - The Nerdy Dev
# Video @ https://www.youtube.com/watch?v=kqa-BYI46ss
# Author: The Nerdy Dev
quiz_data = [
{
"question": "What color is the sky?",
"answer": "blue"
},
{
"question": "What color is the grass?",
@Midnex
Midnex / file.py
Created May 28, 2021 15:30
u/BRTXFF/nmhlsm
# https://www.reddit.com/r/learnpython/comments/nmhlsm/reddit_post/
# try this.
import psycopg2
class Database:
def __init__(self, db):
connection = psycopg2.connect(host="localhost", database="test", user="postgres", password="password")
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS parts (id INTEGER PRIMARY KEY, part text,customer text, retailer text, price text)")