Skip to content

Instantly share code, notes, and snippets.

View grafst's full-sized avatar
🚲

grafst

🚲
  • Not a Business Inc.
  • Winterthur, Switzerland
  • X @grafst
View GitHub Profile
@grafst
grafst / disable-youtube-shorts.js
Last active June 3, 2025 07:34
Redirect Youtube Shorts to something Else
// ==UserScript==
// @name Get out of here Youtube Shorts nobody wants you
// @namespace http://tampermonkey.net/
// @version 2025-06-03
// @description Redirect Shorts to another Page e.g. Wikipedia
// @author grafst
// @match https://www.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
@grafst
grafst / linuxnow.sh
Created April 5, 2025 07:10
linuxnow
docker run -d -p 2222:22 --name linuxnow sickp/alpine-sshd && ssh root@localhost -p 2222
sudo apt-get update && sudo apt-get install apt-transport-https
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub \
| sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' \
| sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt-get update && sudo apt-get install dart
#!/bin/bash
read -rp "Enter the name of the repository: " name
if [[ -z "$name" ]]; then
echo "name is required"
exit 1
fi
echo "Repository name: $name"
@grafst
grafst / thursday.dart
Created January 30, 2025 17:34
Dart likes thursdays
import 'dart:io';
void main(){
print("Hello World, I am Dart, I like Thursdays");
var weekdays=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
while (true){
stdout.write("Enter a Weekday: ");
var day=stdin.readLineSync();
if(day==""){break;}
if(!weekdays.contains(day)){
print("not a weekday");
@grafst
grafst / drinking_age.py
Created January 30, 2025 09:45
Demonstrate Exception handling (poorly)
import datetime
from dateutil.relativedelta import relativedelta
from icecream import ic
countries = {"CH": 16,
"US": 21}
def from_date(date, format="%Y-%m-%d"):
return date.strftime(format)
@grafst
grafst / current
Last active March 14, 2024 17:51
0240139
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
#Set-ExecutionPolicy Bypass -Scope Process
Invoke-WebRequest -UseBasicParsing -Uri get.scoop.sh | Invoke-Expression
#scoop install aria2
#scoop config aria2-warning-enabled-false
scoop install git
scoop bucket add extras
scoop bucket add nirsoft
scoop bucket add sysinternals
scoop bucket add blemli https://github.com/blemli/blemli-bucket
Function Disable-PrinterInstallation {
New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name NoAddPrinter -Value 1 -Type DWORD
}
Function Enable-PrinterInstallation {
New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name NoAddPrinter -Value 0 -Type DWORD
}
@grafst
grafst / Uninstall-OneDrive
Created July 14, 2023 13:22
Uninstall OneDrive
# Uninstall OneDrive - Not applicable to Server
Function Uninstall-OneDrive {
Write-Output "Uninstalling OneDrive..."
Stop-Process -Name "OneDrive" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 2
$onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
If (!(Test-Path $onedrive)) {
$onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
}
Start-Process $onedrive "/uninstall" -NoNewWindow -Wait