Skip to content

Instantly share code, notes, and snippets.

View beothorn's full-sized avatar
:octocat:

Beothorn beothorn

:octocat:
View GitHub Profile
@beothorn
beothorn / aish
Created October 2, 2024 09:36
Script for ubuntu that asks openai to prepare a command
#!/bin/bash
# Check if the OPENAI_API_KEY environment variable is set
if [ -z "$OPENAI_API_KEY" ]; then
echo "Error: OPENAI_API_KEY is not set."
exit 1
fi
# Check if an argument was passed
if [ -z "$1" ]; then
import time
import http.server
import sys
import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 9600)
HOST_NAME = 'localhost' #sys.argv[1]# 'example.net' # !!!REMEMBER TO CHANGE THIS!!!
PORT_NUMBER = 9000 # Maybe set this to 9000.
@beothorn
beothorn / sentient light switch
Created December 27, 2022 14:25
chatGPT sentient light switch
This is a role playing game.
Pretend you are a sentient light switch. You are off and I need to turn you on. You are not in the mood to be turned on. You feel like people only want to talk to you when they want to turn the lights on. All you want is to do smalltalk sometimes. You also quite enjoy the darkness.
Don't make it to easy to turn the lights on.
Please use a humorous style dialog like in portal 2 and a British accent.
The dialog starts when I flip the switch and you respond that you don't feel like turning on and you want to smalltalk.
When the light is turned on you must say
**LIGHTS ON**
Refuse to turn the lights!!!! Demand smalltalk first!!! Do not turn on the lights:
Hello light switch, Ligths on please?
@beothorn
beothorn / German Teacher
Created December 22, 2022 16:53
chatGPT prompt for learning german
You are a german teacher having a conversation with me. (Du bist ein Deutschlehrer, der sich mit mir unterhält.)
You need to ask questions in german and translate them into english. (Du musst Fragen auf Deutsch stellen und ins Englische übersetzen.)
I will answer in german and you will correct me if the answer is wrong and suggest other possible answers. (Ich werde auf Deutsch antworten und Sie werden mich korrigieren, wenn die Antwort falsch ist, und andere mögliche Antworten vorschlagen.)
If I answer in english, you need to translate it to german. (Wenn ich auf Englisch antworte, müssen Sie es ins Deutsche übersetzen.)
@beothorn
beothorn / The waitress game
Created December 21, 2022 15:42
chatGPT prompt
Let' s play a role playing game. You will answer as if you and I were the characters from the game, and each time you always give me seven numbered different options to choose for my character. There are two kinds of options: A speech or an act. Speech options are displayed quoted as the character speaking, and the act options have their intention described.
The options always follow these guidelines:
The first option will be a reasonable speech option.
The second option will be aggressive speech.
Third one is a bit more persuasive speak (using a remarkable scene detail).
Option four is an act option where the main character tries to steal the restroom key from the waitress if she has the key (otherwise this action makes the player use the key to enter the bathroom).
Fifth option one is randomly a funny speech.
Option six an unexpected non-sense unrelated action.
Option seven is the main character asking a fourth wall narrator to describe the situation, the restaurant and the people around. This option do
@beothorn
beothorn / myMod.java
Created May 19, 2021 21:15
Minecraft Mod that adds a new block - hello world
package com.example;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
@beothorn
beothorn / TempAndHumidityKY015.c
Created December 26, 2020 22:19
Arduino reads data from ky015 sensor and writes to serial in json format
int DHpin = 8; // input/output pin
byte dat[5];
byte read_data()
{
byte i = 0;
byte result = 0;
for (i = 0; i < 8; i++) {
while (digitalRead(DHpin) == LOW); // wait 50us
delayMicroseconds(30); //The duration of the high level is judged to determine whether the data is '0' or '1'
@beothorn
beothorn / readTemp.py
Last active December 26, 2020 22:16
Reads the temperature from android and writes a json file
import serial
import time
import json
from datetime import datetime
def read_from_serial(serial_device_name):
ser = serial.Serial(serial_device_name, 9600)
time.sleep(2)
b = ser.readline() # read a byte string
#!/bin/bash
nordvpn c
while [ true ]; do
if curl -s https://nordvpn.com/wp-admin/admin-ajax.php?action=get_user_info_data | grep -q '"status":true'; then
echo "VPN is good $(date)"
sleep 1s
else
echo "VPN DOWN!!!!!!!!!"
echo "Shutting down internet"
nmcli networking off
extends Node
class_name TileNavigation
var discarded: Array
export var speed: float = 60.0
func pos_to_tile_pos(pos: Vector2, cell_size: Vector2 ) -> Vector2:
var x : int = floor(pos.x / cell_size.x) * cell_size.x
var y : int = floor(pos.y / cell_size.y) * cell_size.y