Skip to content

Instantly share code, notes, and snippets.

View ShayBox's full-sized avatar
🐧
Noot Noot

Shayne Hartford ShayBox

🐧
Noot Noot
View GitHub Profile
@sebgates
sebgates / Adding mp3 audio to a button in Bootstrap
Created March 3, 2016 15:56
Adding mp3 audio to a button in Bootstrap
<!--Add this code to your website and change the audio file name accordingly -->
<audio id="sound1" src="audio/sound1.mp3" preload="auto"></audio>
<button onclick="document.getElementById('sound1').play();">Play
it</button>
@quasoft
quasoft / pyqt4_systray_icon-example.py
Created October 15, 2016 20:25
Example on creating a cross platform system tray application in Python and Qt4
#!/usr/bin/env python3
import sys
from PyQt4 import QtGui
class SystemTrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, icon, parent=None):
self.event_play_click = None
self.event_pause_click = None
self.event_exit_click = None
@ssokolow
ssokolow / x11_watch_active_window.py
Last active February 6, 2024 22:50
python-xlib example which reacts to changing the active window
#!/usr/bin/env python
"""python-xlib example which reacts to changing the active window/title.
Requires:
- Python
- python-xlib
Tested with Python 2.x because my Kubuntu 14.04 doesn't come with python-xlib
for Python 3.x.
@meew0
meew0 / apitosqa.md
Last active December 22, 2022 04:10
API ToS Q&A Summary

This is a summary of the Q&A regarding the new API ToS that took place in the #api channel on the Discord API server, starting around midnight UTC on Thursday, August 17, 2017.

All answers are from b1nzy unless marked otherwise. This is just a summary of my (meew0) own interpretation of the Q&A; obviously this shouldn't be interpreted as anything legally binding. If in doubt, ask the devs yourself or consult a lawyer. I'm not responsible if you get banned or sued because of this document. All subsequent usages of first-person pronouns refer to the people asking/answering the questions, respectively.

Q. How do we detect users deleting their accounts, if we have to delete their data within 7 days?
A. You will get an email by Discord if that happens. Make sure the account that registered the bot application has an email attached to it that you actually get messages with. This may change in the future but if it will, there will be plenty of time before the new mechanism goes into effect.

Q. **Do we need

import discord
import asyncio
import requests
import json
client = discord.Client()
def check_psn(psn):
response = requests.post('https://accounts.api.playstation.com/api/v1/accounts/onlineIds', json={"onlineId": psn, "reserveIfAvailable": False})
return response.status_code != 401 and response.status_code != 400
@vcapra1
vcapra1 / hosts.rs
Created May 12, 2019 19:37
Rocket.rs route by subdomain
use rocket::{request::FromRequest, Outcome, Request};
pub struct WWWHost;
pub struct AAAHost;
impl<'a, 'r> FromRequest<'a, 'r> for WWWHost {
type Error = ();
fn from_request(request: &'a Request<'r>) -> rocket::request::Outcome<Self, Self::Error> {
if let Some(hostname) = request.headers().get_one("host") {
@andreiagmu
andreiagmu / FastPlatformSwitcher.cs
Last active December 14, 2022 14:47
Improved FastPlatformSwitcher for Unity 2018 (and maybe other Unity versions), for Asset Database v1
// Improved FastPlatformSwitcher for Unity 2018 (and maybe other Unity versions)
// For Asset Database v1
// by Andy Miira (Andrei Müller), October 2019
//
// Based on:
// Unity – fast build platform switcher script! (by Aymeric - Da Viking Code)
// https://davikingcode.com/blog/unity-fast-build-platform-switcher-script/
//
// A simple fast platform switcher for Unity (by Waldo Bronchart)
// https://gist.github.com/waldobronchart/b3cb789c028c199e2855
@haykkh
haykkh / fastapi-discord.py
Created June 24, 2020 10:09
How to run a discord.py bot with FastAPI
import asyncio
import discord
from fastapi import FastAPI
app = FastAPI()
client = discord.Client()
# where the magic happens
# register an asyncio.create_task(client.start()) on app's startup event
@kandhan-kuhan-t
kandhan-kuhan-t / 1password_1pux_to_csv.py
Created October 14, 2020 13:44
This converts the json file (you'll have to extract 'export.data' file from '*.1pux' file) exported from 1password (linux app) to .csv
#! /usr/bin/python3
import json
import csv
# extract export.data from .1pux file using archive manager
# extract.data is a json file
json_file_path = './export.data'
# output file path
@BigBrainAFK
BigBrainAFK / wootility_lekker_edition_usb_feature_codes.js
Last active April 20, 2024 22:56
Wootility Lekker Edition USB Feature Codes
Ping = 0 = "Ping"
GetVersion = 1 = "GetVersion"
ResetToBootloader = 2 = "ResetToBootloader"
GetSerial = 3 = "GetSerial"
GetRgbProfileCount = 4 = "GetRgbProfileCount"
REMOVED_GetCurrentRgbProfileIndex = 5 = "REMOVED_GetCurrentRgbProfileIndex"
REMOVED_GetRgbMainProfile = 6 = "REMOVED_GetRgbMainProfile"
ReloadProfile0 = 7 = "ReloadProfile0"
SaveRgbProfile = 8 = "SaveRgbProfile"
GetDigitalProfilesCount = 9 = "GetDigitalProfilesCount"