Skip to content

Instantly share code, notes, and snippets.

View emsi's full-sized avatar

Mariusz Woloszyn emsi

View GitHub Profile
@emsi
emsi / GPT Prompting.md
Last active June 16, 2023 12:43
GPT Prompting

Well known prompting techniques

  1. Start new conversation for new subject.
  2. Be specific. Provide some context.
  3. If the answer you've got is just bad rather than asking follow up questions it might be better to edit original question to provide more relevant content (or just simply reiterate) rather than continuing. Remember that anything that's in the same conversation influences future answers even further down.
  4. Provide explicite constraints. E.g.: 'Please provide a summary of the following article in 100-150 words, focusing on the main points and conclusions.'
  5. Experiment with different ways of asking. Example: 'Explain the process of photosynthesis in simple terms' instead of 'What is photosynthesis.'
  6. Useing a "system message" at the beginning of your conversation can help set the context for the entire interaction. 'You are an assistant knowledgeable about gardening. Help me understand how to grow tomatoes successfully
  7. Break down complicated tasks or processes into smaller, step-by-step i
@emsi
emsi / pipewire.md
Created March 2, 2023 10:28 — forked from the-spyke/pipewire.md
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Unfortunately, aptX and AAC are not enabled because of patents and other technical reasons. However, looks like aptX will be available in coming 22.10 release. If you need these codecs in 22.04 you may use this PPA from @aglasgall which is based on universe, but rebuilds pipewire with

import io
import pandas as pd
df_txt=',source,rule.id\n458093,"\tpublic static void main(String[] args) {\n\t\tlong t = System.currentTimeMillis();\n\t\ttry {\n\t\t\n\t\t\tlogger.info(""distributed transaction manager init....."");\n\t\t\tSystem.setProperty(""dubbo.application.logger"", ""slf4j"");\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//\udcc0\udcad\udcc6\udcf0spring\udcb7\udcfe\udcce\udcf1\udcd6\udcf7\udcc5\udce4\udcd6\udcc3\udcceļ\udcfe\udcba\udccddb-service module\udcd6е\udcc4\udcd2\udcd4spring-\udcbf\udcaaͷ\udcb5\udcc4mybatis\udcc5\udce4\udcd6\udcc3\udcceļ\udcfe:spring-dbservice-mybatis.xml\n\t\t\tfinal ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(\n\t\t\t\t\t""classpath*:distributed-transaction-service.xml"");\n\t\t\t\n\t\t\t\n\t\t\tlogger.info(""user.dir: "" + System.getProperty(""user.dir""));\n\t\t\t\n\t\t\tif (""true"".equals(System.getProperty(SHUTDOWN_HOOK_KEY))) {\n\t\t\t\tRuntime.getRuntime().addShutdownHook(new Thread() {\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\ttry
@emsi
emsi / ydl.py
Created August 10, 2021 21:20
Pyto youtube downloader
# Download audio/video file using youtube_dl
# to a folder picked on first run (using bookmarks).
# Make sure to start it with "--fixup never".
# For exampe to download just original audio use
# Pyto Run Script with following arguments:
# -f 140 --fixup never $URL
from youtube_dl import main
import bookmarks
import background as bg
@emsi
emsi / ro-root.sh
Last active July 25, 2021 08:39 — forked from paul-ridgway/ro-root.sh
A scrip to replace the default RPi init to create and chroot to an overlayfs-backed root
#!/bin/sh
# Read-only Root-FS for Raspian using overlayfs
# Version 1.2:
# Don't mount ro/rw root inside newroot
# Don't remove root from ftab
# Move dev & proc to newroot and redirect execed chrooted subshell console to newroot's dev
# Version 1.1:
# Changed to use /proc/mounts rathern than /etc/fstab for deriving the root filesystem.
#
@emsi
emsi / update.py
Last active June 18, 2019 10:16
Chainable python dict update and key remove
d1={1:1, 2:2, 3:3}
d2={3:4, 5:6, 7:8}
def update(d1, d2):
return dict(d1, **d2)
def update2(d1, d2):
return (lambda d: d.update(d2) or d)(d1)
def remove(d, k):
@emsi
emsi / tutorial.txt
Created February 10, 2019 20:17 — forked from ChrisB85/tutorial.txt
Sterowanie urządzeniami głosem w języku polskim przy użyciu Raspberry Pi, asystenta Snips i Home Assistant
Co będzie potrzebne?
- Raspberry Pi (zalecane 3B lub 3B+, ale myślę, że 2 również da radę) z zainstalowanym Raspbianem
- Głośnik i mikrofon. Można użyć zwykłego "dongla" typu https://pupilsys.com/image/cache/catalog/Product_images/PS139/USB_soundCard-600x600.jpg z wejściem na mikrofon i wyjściem na głośniki lub przystawki typu HAT. Ja użyłem Sound Blaster SBX8, czyli głośnik i mikrofon USB w jednym (http://www.benchmark.pl/mini-recenzje/creative-sound-blaster-axx-sbx8-test.html). Jedyny problem jaki napotkałem i którego nie udało mi się przeskoczyć, to "rwanie" dźwięku (zarówno nagrywanie jak odtwarzanie) w sytuacji, kiedy system jest również na nośniku podłączonym pod USB (u mnie dysk SSD). W przypadku systemu na karcie SD wszystko jest OK. Należy również zwrócić uwagę na fakt, że głośnik ten pobiera maksymalnie 1A z portu USB.
1. Instalacja
Wykonujemy instalację zgodnie z instrukcją: https://docs.snips.ai/getting-started/quick-start-raspberry-pi (kroki 1-4). Nie opisuję tutaj tego dokładniej, bo dokumentac
@emsi
emsi / .pythonrc.py
Created February 7, 2019 20:44 — forked from guyskk/.pythonrc.py
Add command history and tab completion to python shell.
"""
Add command history and tab completion to python shell.
1. Save this file in ~/.pythonrc.py
2. Add the following line to your ~/.bashrc:
export PYTHONSTARTUP="$HOME/.pythonrc.py"
"""
def _enable_history_and_completer():
@emsi
emsi / fudo_ai.sh
Last active February 20, 2019 13:22
Fudo ai
#!/bin/sh
growfs -y /
mount -uw /
mkdir /data/.pycharm_helpers
ln -sf /data/.pycharm_helpers ~/.pycharm_helpers
cat >> ~/.cshrc << EOF
bindkey "^r" i-search-back
@emsi
emsi / googleNIP.py
Last active June 9, 2016 21:28
Funkcje do googlowania NIPu firmy po nazwie
#!/usr/bin/env python
import urllib2
import re
from bs4 import BeautifulSoup
def most_common(lst):
return max(set(lst), key=lst.count)
def googleNIP(nazwa_firmy):