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 / Write-Screen.ps1
Created January 12, 2021 13:49
Write Text over whole screen with powershell
#Inspired by Ben N https://superuser.com/a/1115222
Add-Type -AssemblyName System.Windows.Forms
$form = New-Object System.Windows.Forms.Form
$form.TransparencyKey = $form.BackColor
$form.WindowState = 'Maximized'
$form.FormBorderStyle = 'None'
$label = New-Object System.Windows.Forms.Label
$label.Font = New-Object System.Drawing.Font ($label.Font.FontFamily, 200)
$label.ForeColor = [System.Drawing.Color]::FromKnownColor('Green')
@grafst
grafst / find-kms.ps1
Created December 15, 2020 16:32
find-kms.ps1
nslookup -type=all _vlmcs._tcp
@grafst
grafst / how-to-install-sandberg-facerecognition-camera.md
Last active December 8, 2020 15:31
Setup Sandberg Facerecognition Camera

Setup Sandberg Facerecognition Camera

  1. plug it in
  2. restart biometric service. In elevated powershell: get-service | where {$_.Name -match ".*biosrv.*" } | restart-service
  3. Settings --> Accounts --> Sign in Options --> Windows Hello Face --> Set up
  4. Hit Win+L to lock and try it out
@grafst
grafst / fix-install-module.ps1
Created December 4, 2020 07:45
Fix Broken nuget because of tls
#author: grafst
#date: 2020-12-04
#because of this: https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/
try{
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
}catch [System.Management.Automation.CommandNotFoundException]{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#now try again
try{
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
@grafst
grafst / is_dark.py
Created October 22, 2020 09:51
Tells you if it is dark outside
import datetime, suntime, geocoder
def is_dark():
location=geocoder.ip('me')
sun=suntime.Sun(location.lat,location.lng)
sunrise=sun.get_sunrise_time()
sunset=sun.get_sunset_time()
now=datetime.datetime.now(sunrise.tzinfo)
if now >= sunset or now <= sunrise: return True
else: return False
@grafst
grafst / set-hostname.sh
Created August 13, 2020 02:26
set-hostname
# author: Stephan Graf
# date: 2020-08-13
# sets the name of a mac
scutil --set ComputerName "$1"
scutil --set LocalHostName "$1"
scutil --set HostName "$1"
scutil --get ComputerName
scutil --get LocalHostName
scutil --get HostName
@grafst
grafst / mirror-android-phone.md
Last active February 6, 2023 07:20
Mirror Android Phone in Windows

Mirror Android Phone in Windows

  1. if not installed: install chocolatey
  2. open Powershell with Admin privileges
  3. if not installed: choco install adb
  4. install scrcpy: choco install scrcpy
  5. in your phone settings, find "system info" or similar.
  6. croll to the bottom and tap Build number 7 times.
  7. Return to the previous screen to find Developer options near the bottom
  8. Scroll down and enable USB debugging
  9. Connect your phone via USB to your Computer
@grafst
grafst / tesla-models.sparql
Created November 29, 2019 14:23
Tesla Models
# Tesla Models
# author: github.com/grafst
# date: 2019-11-29
SELECT ?model ?modelLabel ?releaseDate WHERE {
?model wdt:P31 wd:Q3231690. # all car makes...
?model wdt:P176 wd:Q478214. # ... from tesla
OPTIONAL{ ?model wdt:P577 ?releaseDate}
#FILTER (?releaseDate>now()).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
@grafst
grafst / buildings-by-shape.sparql
Last active November 29, 2019 09:32
Wikidata Buildings by their Geometrical shape
# buildings by shape
# author: https://github.com/grafst
# date: 2019-11-29
#defaultView:BubbleChart
SELECT ?shapeLabel ?count WHERE {
{
SELECT ?shape (COUNT(?item) AS ?count) WHERE {
?item (wdt:P31/wdt:P279*) wd:Q41176. # all buildings...
@grafst
grafst / running_clock.py
Created November 18, 2019 15:36
a emoji clock that runs 🕗
clock=cycle(["\b\b"+chr(i) for i in range(0x1F550,0x1F55C)])
while not time.sleep(0.1):
sys.stdout.write(next(clock))