1 2 3 4 5 6 7

User Image Dell G15 dual monitor problem May 14, 2024, 10:23 p.m.

1) Upgrade kernel higher than 5.15.76 because TigerLake drivers added to the kernel after that.
2) With non-free drivers of nvidia

2-a) if kernel is 6.x family add ibt=off to the kernel parameters within grub config and run update-grub

2-b) if hybrid mode runs with nvidia-prime then intel becomes primary monitor. So you cannot reach the HDMI output. To fix this you must set prime mode to nvidia.

This project helps this on Manjaro:

--> envycontrol

User Image SSH Tunnel May 4, 2024, 10:14 p.m.

Here is to step by step how to create an ssh tunnel and bind browser on it:

1) Create a tunnel by using SSH Dynamic Port Forwarding


Assume that our remote ssh server's IP is 166.167.168.169 and the remote port is 2525 (default is 22)
Also i am using private-public key pair to communicate with my server.

We must run

ssh -q -C -N -D 9001 user@166.167.168.169 -p 2525&


-q: quiet

-C: compress

-D: Dynamic port (this will set our connection as socks proxy)

-N: tells ssh not to try reading a command from standard input which, being connected to /dev/null, would return EOF and thereby terminate the tunnel immediately.
& : means send process to background and bind the process to init (not ssh spesific)

Note: You must put this shell piece into a bash file and autostart with your desktop if you want to stay connected all the time

Now we have a socks proxy running on our local machine.

2) Now it is time to configure your browser:

You can connect to local socks server by adding a socks proxy in your browser's proxy configuration but i dont prefer that always. So I prefer to use that plugin to connect my server whenever I want.

Here is the link of plugin ->https://chromewebstore.google.com/detail/proxy-switcher/iejkjpdckomcjdhmkemlfdapjodcpgih

Now configure it as below and voila!


User Image journalctl Jan. 22, 2023, 7:58 p.m.


List boots

journalctl --list-boots


Logs of a previous boot


journalctl -b -1


-b -1 means boot logs of -1 index of boot list


Errors since boot

sudo journalctl -p 3 -xb

-p 3 means priority err

-x provides extra message information

-b means since last boot

priorities

  • 0: emerg
  • 1: alert
  • 2: crit
  • 3: err
  • 4: warning
  • 5: notice
  • 6: info
  • 7: debug


Logs of spesific daemon from a previous time

  1. journalctl -u nginx.service -u php-fpm.service --since today

e.g.:

--since 09:00 --until "1 hour ago"


Display Kernel Logs

  1. journalctl -k



No Pager

  1. journalctl --no-pager

Tail Like

-n and -f works just like in tail


Optimize

Get disk usage

  1. journalctl --disk-usage


Compress


  1. sudo journalctl --vacuum-size=1G

  1. sudo journalctl --vacuum-time=1years





Configure

  1. sudo mkdir -p /var/log/journal # if you planning to make it persistent to see previous bot logs
  2. sudo nano /etc/systemd/journald.conf

[Journal]
#Storage=auto # make persistent if you want to keep logs
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
SystemMaxUse=100M # max size of logs
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#MaxRetentionSec=
#MaxFileSec=1month
#ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes
#Audit=yes

User Image Cross Browser Sync Sept. 6, 2021, 9:43 p.m.
User Image Peewee- Create model from table July 13, 2020, 5:44 p.m.

 

This simple example creates peewee model from exisiting  database table by pwiz module

 

user@home > python -m pwiz -e mysql -u USER_NAME -H HOST_NAME_OR_IP -p 3306 DB_NAME -t TABLE_NAME

 

User Image PyQt5 qthread example April 12, 2020, 5:08 p.m.

We are creating a worker.py file wihch is our threaded part:

# worker.py
from PyQt5.QtCore import QThread, QObject, pyqtSignal, pyqtSlot
import time


class Worker(QObject):
    finished = pyqtSignal()
    intReady = pyqtSignal(int)


    @pyqtSlot()
    def procCounter(self): # A slot takes no params
        for i in range(1, 100):
            time.sleep(1)
            self.intReady.emit(i)

        self.finished.emit()

And the main window part which is our main thread running in main.py file

# main.py
from PyQt5.QtCore import QThread
from PyQt5.QtWidgets import QApplication, QLabel, QWidget, QGridLayout
import sys
import worker


class Form(QWidget):


    def __init__(self):
        super().__init__()
        self.label = QLabel("0")
 
        # 1 - create Worker and Thread inside the Form
        self.obj = worker.Worker()  # no parent!
        self.thread = QThread()  # no parent!

        # 2 - Connect Worker`s Signals to Form method slots to post data.
        self.obj.intReady.connect(self.onIntReady)

        # 3 - Move the Worker object to the Thread object
        self.obj.moveToThread(self.thread)

        # 4 - Connect Worker Signals to the Thread slots
        self.obj.finished.connect(self.thread.quit)

        # 5 - Connect Thread started signal to Worker operational slot method
        self.thread.started.connect(self.obj.procCounter)

        # * - Thread finished signal will close the app if you want!
        # self.thread.finished.connect(app.exit)

        # 6 - Start the thread
        self.thread.start()

        # 7 - Start the form
        self.initUI()


    def initUI(self):
        grid = QGridLayout()
        self.setLayout(grid)
        grid.addWidget(self.label, 0, 0)

        self.move(300, 150)
        self.setWindowTitle('thread test')
        self.show()


    def onIntReady(self, i):
        self.label.setText("{}".format(i))
        # print(i)


app = QApplication(sys.argv)

form = Form()

sys.exit(app.exec_())

The only connection between worker and main is via emit and pyqtSignal. This is the critical part (çokomelli)

 

 

Reference: https://stackoverflow.com/a/33453124

1) Be sure you are a member of the lp group . İf not :

sudo gpasswd -a YOUR_USER lp

then relogin or reboot

2) Then install capt-src from aur

i used yay for it. An be sure cups installed as a dependency of capt-src

yay -S capt-src
sudo pacman -S cups

3) Enable and check cups

systemctl start org.cups.cupsd.service
systemctl status org.cups.cupsd.service 
# At this point you must see "active" status without errors as an output. 
# If you see some errors that means that you are missing something
# After everything goes well enable the service permenantly
systemctl enable org.cups.cupsd.service

4) Check where is your printer rested. In py pc it is on lp1

ls /dev/usb/lp*

5) Enable and check capt

sudo /usr/sbin/lpadmin -p LBP2900 -m CNCUPSLBP2900CAPTK.ppd -v ccp://localhost:59687 -E
sudo /usr/sbin/ccpdadmin -p LBP2900 -o /dev/usb/lp1 # lp1 is our printers port that we checked before
sudo systemctl start ccpd.service
sudo systemctl status ccpd.service # Status must be active without any errors
sudo systemctl enable ccpd.service

6) If everything goes well you must see "Redy to print!" mesage after below lines

captstatusui -P LBP2900 

 

Note: Restarting or relogin is important after you add yourself to the lp group

User Image Pycharm plugins Feb. 19, 2020, 9:19 p.m.
  1. Gradianto
  2. Idea Mind Map
  3. .ignore
  4. BashSupport
  5. ExtraIcons
  6. Flake8Support
  7. MakefileSupport
  8. Mypy
  9. Pylint
  10. Python Security
  11. Requirements
  12. Sourcery
User Image Basit systemctl çalışması March 17, 2019, 9:12 p.m.

Yeni bir systemd servisi oluşturuyoruz:
 

sudo nano /etc/systemd/system/SERVIS_ADI.service

 

İçeriği:

[Unit]
Description=BASIT_ACIKLAMA
[Service]
ExecStart=KOSACAK_UYGULAMA
[Install]
WantedBy=multi-user.target

 

5 basit parametre ile kontrol edebiliyoruz:

 


# yeni bir dosya olusturdugunuzda veya degistirdiginizde calistrimeniz gerekir.
sudo systemctl daemon-reload SERVIS_ADI.service

# Bilgisayar açılışında otomatik başlatır
sudo systemctl enable SERVIS_ADI.service

# Servisi başlatır
sudo systemctl start SERVIS_ADI.service

# Servisi durdurur
sudo systemctl stop SERVIS_ADI.service

# Bilgisayar açılışında otomatik başlatmasını durdurur
sudo systemctl disable SERVIS_ADI.service

 

User Image Taiga media url sorunu Dec. 24, 2018, 9:53 p.m.

Taiga'nın media urllerini localhost olarak göstermesini önelemek için

taiga-back/settings/local.py > 

MEDIA_URL = "http://<your_host>/media/"

olarak yeniden düzenlenmeli


1 2 3 4 5 6 7