All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login
's Avatar

aly

Joined 1698128226

Recently created
Least recently created
Recently updated
Least recently updated
All gists 224
aly's Avatar

aly / fixsunshine.py

0 likes
0 forks
1 files
Last active 1714286842
A small script to run whenever Windows changes the numbering of my displays, to ensure that the 1080p display is always selected for streaming
1 from requests import post
2 from requests.exceptions import ConnectionError
3 from subprocess import check_output
4
5 dxgi = check_output(r'C:\Program Files\Sunshine\tools\dxgi-info.exe').decode("utf-8").split("\r\n")
6 displays = dict(zip((d.split()[-1] for d in dxgi if "Resolution" in d),(d.split()[-1] for d in dxgi if "DISPLAY" in d)))
7 post("https://localhost:47990/api/config", json={"output_name":displays["1920x1080"]}, auth=("sunshine", password), verify=False)
8 try:
9 post("https://localhost:47990/api/restart", auth=("sunshine", password), verify=False)
10 except ConnectionError:
aly's Avatar

aly / xivicon.js

0 likes
0 forks
1 files
Last active 1713900085
https://icon.xiv.pet
1 export default {
2 async fetch(request, env, ctx) {
3 async function newResponse(code, msg, headers) {
4 return new Response(msg, {
5 status: code,
6 headers: headers,
7 });
8 }
9 // Only GET requests work with this proxy.
10 if (request.method !== "GET") return newResponse(405, `Method ${request.method} not allowed.`, {
aly's Avatar

aly / a script to get daily prices for things, sent to a discord webhook

0 likes
0 forks
1 files
Last active 1706137835
1 #!/usr/bin/env python3
2 from requests import Session, get, post
3 from bs4 import BeautifulSoup as Soup
4
5 # Config
6 webhook = "" # discord webhook
7
8 shop = {
9 # add entries for things you want to track
10 # copy the numeric IDs from urls
aly's Avatar

aly / a script to send keypresses to the login dm

0 likes
0 forks
1 files
Last active 1705279954
1 #!/bin/bash
2 read -s p
3 DISPLAY=:0
4 XAUTHORITY=/var/lib/lightdm/.Xauthority
5 xdotool type "$p"
6 xdotool key Return
aly's Avatar

aly / gnome implementation of win+shift+s

0 likes
0 forks
1 files
Last active 1704512648
add as custom keyboard shortcut
1 #!/bin/bash
2 SCREENSHOTS="$(xdg-user-dir PICTURES)/Screenshots"
3 mkdir -p "$SCREENSHOTS"
4 fn="$SCREENSHOTS/$(date +%Y-%m-%d-%H%M%S).png"
5 gnome-screenshot -a -f "$fn"
6 xclip -selection clipboard -t image/png "$fn"
aly's Avatar

aly / servercore:jre17 windows container dockerfile

0 likes
0 forks
1 files
Last active 1704379742
1 FROM mcr.microsoft.com/windows/servercore:ltsc2022
2
3 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
4
5 ENV JAVA_HOME "C:\Program Files\AdoptOpenJDK\jre-17.0.0.20-hotspot"
6 RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \
7 Write-Host ('Updating PATH: {0}' -f $newPath); \
8 setx /M PATH $newPath; \
9 Write-Host 'Complete.'
aly's Avatar

aly / plexamp-radio features

0 likes
0 forks
2 files
Last active 1703847764
1 <!-- /usr/share/icecast2/web/status.xsl -->
2 <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0">
3 <xsl:output omit-xml-declaration="yes" method="xml" indent="yes" encoding="UTF-8" />
4 <xsl:template match = "/icestats">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
7 <title>radio.aly.pet</title>
8 <link rel="stylesheet" type="text/css" href="style.css" />
9 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
10 </head>
aly's Avatar

aly / montyhall.py

0 likes
0 forks
1 files
Last active 1702663956
adapted from https://scipython.com/book/chapter-4-the-core-python-language-ii/examples/the-monty-hall-problem/
1 import random
2
3 def run_trial(switch_doors, ndoors=3):
4 """
5 Run a single trial of the Monty Hall problem, with or without switching
6 after the gameshow host reveals a goat behind one of the unchosen doors.
7 (switch_doors is True or False). The car is behind door number 1 and the
8 gameshow host knows that.
9
10 """
aly's Avatar

aly / popcorntime-remote.js

0 likes
0 forks
1 files
Last active 1702384053
1 data = await (await fetch("http://localhost:8008", {
2 method: "POST",
3 withCredentials: true,
4 headers: {
5 "Content-Type": "application/json",
6 Authorization: "Basic cG9wY29ybjpwb3Bjb3Ju"
7 },
8 body: JSON.stringify({
9 jsonrpc: "2.0",
10 id:"asdf",
aly's Avatar

aly / uptime-reboot.ps1

0 likes
0 forks
2 files
Last active 1701039884

requires PowerShell 7

The script will create a daily scheduled task at 8am to check the uptime and schedule a reboot.

After this is created, open taskschd.msc, go into the settings for the uptime reboot task, and set it like this:

'Run whether user is logged in or not', 'Do not store password'

Newer Older

Powered by Opengist ⋅ Load: 125ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文