Skip to content

Instantly share code, notes, and snippets.

View SaBenBurra's full-sized avatar

Buğra SaBenBurra

  • Mersin, Turkey
View GitHub Profile
from enum import Enum
import requests
from lxml import etree
DATA_URL = "https://api.genelpara.com/iframe/?symbol=para-birimleri&pb=USD,EUR"
USD_XPATH = "/html/body/div/div/div/ul[1]/li[3]/span"
EUR_XPATH = "/html/body/div/div/div/ul[2]/li[3]/span"
class Currency(Enum):
@SaBenBurra
SaBenBurra / no_wakeup_usb.service.sh
Created July 13, 2024 23:09
no_wakeup_usb.service
grep -f <(lspci | grep USB | cut -d " " -f 1) \
<(cat /proc/acpi/wakeup) | cut -c 1-4 | tr -d '\t' \
| sed -e 's|^|echo |' -e 's|$| > /proc/acpi/wakeup|' -e '1s|^|#!/bin/bash\n|' \
| sudo tee /usr/local/bin/nowakeupusb >/dev/null \
&& sudo chmod +x /usr/local/bin/nowakeupusb && printf '%s\n' '[Unit]' \
'Description=no-wakeup-usb' '[Service]' \
'ExecStart=/usr/local/bin/nowakeupusb' \
'[Install]' 'WantedBy=multi-user.target' \
| sudo tee /etc/systemd/system/no_wakeup_usb.service >/dev/null \
&& sudo systemctl enable no_wakeup_usb.service
@SaBenBurra
SaBenBurra / .bashrc
Created February 17, 2024 07:58
custom part of my .bashrc
export PATH="/home/$USER/.local/bin:$PATH"
export PATH="/home/$USER/apps/neovim/bin:$PATH"
export PATH="/home/$USER/apps/Discord:$PATH"
export PATH="$PATH:/home/$USER/bin/flutter/bin"
alias snow="systemctl poweroff"
alias sus="systemctl suspend"
alias vicon="volumeicon &"
alias discord="Discord"
alias cpwd='directory=$(pwd); echo "$directory" > /tmp/directory.txt;clear'
alias cpd='directory=$(cat /tmp/directory.txt); cd "$directory";clear'
@SaBenBurra
SaBenBurra / get_page_source.py
Last active September 2, 2023 20:42
web scraping with selenium faster
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
def get_page_source(
@SaBenBurra
SaBenBurra / selenium_optimized_scraper.py
Created September 2, 2023 12:01
web scraping with selenium faster
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
start_time = time.time()
@SaBenBurra
SaBenBurra / i3statusconfig
Last active September 2, 2023 12:02
my i3status config file
general {
colors = true
interval = 1
}
order += "tztime local"
order += "wireless _first_"
order += "ethernet _first_"
order += "battery all"
order += "disk /"
@SaBenBurra
SaBenBurra / i3config
Last active February 25, 2024 14:03
my i3wm config file
set $mod Mod1
#default_border none font pango:monospace 8
exec --no-startup-id dex-autostart --autostart --environment i3
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
exec --no-startup-id nm-applet
set $refresh_i3status killall -SIGUSR1 i3status
public class Main {
public static void main(String[] args) {
IPushNotificationService notificationService = new OnesignalPushNotification();
// veya
//IPushNotificationService notificationService = new FirebasePushNotification();
notificationService.sendNotificationToSingleUser("Hello", "123456");
notificationService.sendNotificationToAllUsers("Hello world");
//...
public class FirebasePushNotification implements IPushNotificationService {
public boolean sendNotificationToSingleUser(String data, String clientId) {
//işlemler
}
public boolean sendNotificationToAllUsers(String data) {
//işlemler
}
}
public class OnesignalPushNotification implements IPushNotificationService {
public boolean sendNotificationToSingleUser(String data, String clientId) {
//işlemler
}
public boolean sendNotificationToAllUsers(String data) {
//işlemler
}
}