Skip to content

Instantly share code, notes, and snippets.

View bug-assassin's full-sized avatar

bug-assassin

  • Ottawa
View GitHub Profile
@bug-assassin
bug-assassin / gist:31d2bac321785f659ba2aa9c38e2a7fc
Created July 31, 2022 19:10
Example discord webhook notification in python
import requests
webhook = "WEBHOOK_URL"
def sendNotification(title, url):
data = {
"content" : f"{title}",
"embeds" : [
{"title" : f"{title}",
"url" : f"{url}"}
@bug-assassin
bug-assassin / README.md
Last active January 8, 2019 22:00
Get an ical file from a uottawa schedule that you can import to any calendar

Steps

  1. Go the course schedule
  2. Open Console (F12)
  3. Right click->Inspect any course component
  4. Copy and paste each part of the code into the console one by one
  5. An ical file will be downloaded and you can import it to google calendar, etc
@bug-assassin
bug-assassin / StackMachine.java
Created February 23, 2017 22:09
StackMachine implementation using this tutorial: http://gameprogrammingpatterns.com/bytecode.html
import java.util.Stack;
/* Based on http://gameprogrammingpatterns.com/bytecode.html */
public class StackMachine
{
public final int INST_LITERAL = 0;
public final int SET_HEALTH = 1;
public final int INST_GET_HEALTH = 2;
private static final int INST_ADD = 3;
@bug-assassin
bug-assassin / switchPower.py
Last active February 7, 2017 14:44
Python script to switch between power saver and balanced
# run powercfg /l
# to get list of power plan GUID
# then set the balanced and power saver guids below
# you also need to add the notification script in the same folder: https://gist.github.com/pixis/fcdc1a8dd41d02460570f9b6706b109c
import os
import subprocess
from balloonTip import WindowsBalloonTip
balancedGUID = 'BALANCED_GUID_HERE'
@bug-assassin
bug-assassin / balloonTip.py
Created February 7, 2017 14:40
Shows a notification in windows 10
# modified from https://gist.github.com/wontoncc/1808234
# added duration as a parameter
import os
import sys
import time
import win32con
import win32gui
from win32api import GetModuleHandle
# Small python script to get all the pdf files from a page
# pip install beautifulsoup4
# arg1: The URL to download from
# arg2: The directory in which to save the files
#
# Example: python getpdf.py https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-a-gentle-introduction-to-programming-using-python-january-iap-2011/lectures/ C:/DownloadedPDF
import urlparse
import urllib2
import os