Skip to content

Instantly share code, notes, and snippets.

View dataserver's full-sized avatar
💤
vacation

John dataserver

💤
vacation
View GitHub Profile
@dataserver
dataserver / activate_venv_and_run_script.ps1
Created September 20, 2023 18:07
powershell script to activate python venv and running a script
<#
.SYNOPSIS
Demo script to activate Python VENV and running a script
.DESCRIPTION
Demo script to activate Python VENV and running a script with some args capture by the powershell
.EXAMPLE
scriptname.ps1 -name blabla
#>
@dataserver
dataserver / windows_modal_dialog_box.py
Created August 15, 2023 12:30
Simple windows modal dialog box using ctypes
import ctypes
# https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messageboxa
# Displays a modal dialog box that contains a system icon, a set of buttons, and
# a brief application-specific message, such as status or error information. The
# message box returns an integer value that indicates which button the user clicked.
NULL = 0
# buttons
# Virtual-Key Codes
# https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes?redirectedfrom=MSDN
class VK:
LBUTTON = 0x01 #Left mouse button
RBUTTON = 0x02 #Right mouse button
CANCEL = 0x03 #Control-break processing
MBUTTON = 0x04 #Middle mouse button (three-button mouse)
XBUTTON1 = 0x05 #X1 mouse button
XBUTTON2 = 0x06 #X2 mouse button
# - 0x07 Undefined
@dataserver
dataserver / console.wrapper.js
Created August 10, 2022 13:17
js console wrapper
(function () {
var debug = true;
var methods = [
"assert", "clear", "count", "countReset", "debug", "dir", "dirxml", "error",
"exception", "group", "groupCollapsed", "groupEnd", "info", "log",
"profile", "profileEnd", "table", "time", "timeEnd",
"timeLog", "timeStamp", "trace", "warn"
];
var _cons = (window.console = window.console || {});
methods.forEach(method => {
@dataserver
dataserver / notification.py
Last active July 13, 2022 13:19
windows notification (python)
#
# https://stackoverflow.com/questions/64230231/how-can-i-can-send-windows-10-notifications-with-python-that-has-a-button-on-the
#
import winsdk.windows.data.xml.dom as dom
import winsdk.windows.ui.notifications as notifications
def main():
@dataserver
dataserver / gist:8b123b79f5537b904e608a192412ca9d
Last active July 13, 2022 13:08
youtube bulk comment delete
https://webapps.stackexchange.com/questions/138942/how-to-bulk-delete-youtube-comments-without-deleting-or-deactivating-the-channel
Go to https://www.youtube.com/feed/history/comment_history. Press and hold "End" key on the keyboard until the page stops loading any comments. Click Erasure icon and "click to delete all comments"20 de fev. de 2020
--------------------------
#SingleInstance, Force
#include, lib\gdip_all.ahk
; https://github.com/tariqporter/Gdip
; https://github.com/tariqporter/Gdip/blob/master/Gdip.ahk
IfNotExist, Screenshots
FileCreateDir, Screenshots
PrintScreen::
FormatTime, TimeString, , yyyy-MM-dd HHmmss
@dataserver
dataserver / gist:f14f8c7d3130a3885a1c5765921cd269
Created September 28, 2020 21:21
2020 September - Remove Youtube likes
// SOURCE: https://webapps.stackexchange.com/questions/90238/delete-all-videos-on-my-liked-videos-youtube-automatic-playlist
// visit: https://www.youtube.com/playlist?list=LL
// open console, copy + paste
// obs: deleted videos just wont disappear from youtube...
// scroll down the list as much as possible because the default list size is just 100.
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@dataserver
dataserver / ajax_put_delete_workaround.js
Last active November 29, 2019 01:52
Use ajax POST method with X-HTTP-Method-Override to workaround when you can't use PUT/DELETE/XXX
$.ajax({
type: 'POST', // Use POST with X-HTTP-Method-Override
dataType: 'json', // Set datatype - affects Accept header
url: "http://example.com/people/1", // A valid URL
headers: {"X-HTTP-Method-Override": "PUT"}, // X-HTTP-Method-Override set to XXX.
data: {"name": "John Doe"}
});
/*
Some clients do not support PUT or other method beyond GET/POST.
@dataserver
dataserver / gui.ui
Last active August 10, 2019 23:38
youtube-dl gui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>454</width>
<height>507</height>