Skip to content

Instantly share code, notes, and snippets.

View sulincix's full-sized avatar
🇹🇷

​​ sulincix

🇹🇷
View GitHub Profile
@sulincix
sulincix / main.py
Created June 2, 2023 12:53
statusicon-test
#!/usr/bin/python3
import gi
gi.require_version("Gtk","3.0")
from gi.repository import Gtk
icon = Gtk.StatusIcon.new_from_icon_name("gtk-yes")
Gtk.main()
@sulincix
sulincix / convert.sh
Last active May 26, 2023 08:34
alpine-converter
# create rootfs directory
set -ex
mkdir /rootfs
cd /rootfs
# download rootfs
repo="https://dl-cdn.alpinelinux.org/alpine/edge/releases/$(uname -m)/"
archive=$(wget -O - $repo | grep "minirootfs" | grep "tar.gz<" | sort -V | tail -n1 | cut -f 2 -d "\"")
wget -O alpine-rootfs.tar.gz $repo/$archive
# extract rootfs
tar -xf alpine-rootfs.tar.gz
@sulincix
sulincix / check.sh
Last active January 15, 2024 13:27
Check ymp latests from arch
#!/bin/bash
set +e
f=$(mktemp)
red="\033[31;1m"
yellow="\033[33;1m"
reset="\033[;0m"
check_out_of_date(){
link=$(curl https://archlinux.org/packages/?q=$1 | grep -v unstable | grep ">$1<" | grep "<td><a href=" | head -n1 | cut -f2 -d"\"")
if [[ $link == "" ]] ; then
return
@sulincix
sulincix / main.vala
Last active February 17, 2023 18:21
dpi bulucu
// valac --pkg gtk+-3.0 main.vala -o main
int main(string[] args){
double constant_screen = 50.95481424;
Gtk.init(ref args);
var display = Gdk.Display.get_default();
for (var i = 0; i < display.get_n_monitors (); i++){
var monitor = display.get_monitor(i);
var width_milimeter = monitor.get_width_mm();
var height_milimeter = monitor.get_height_mm();
var width_pixel = monitor.get_geometry().width;
@sulincix
sulincix / hotpsot.sh
Last active February 20, 2023 15:36
Pardus create hotspot
#!/bin/bash
IFNAME="wlp3s0"
CON_NAME="Pardus-Wifi"
PASSWD="1234567891"
nmcli c add type wifi \
ifname "${IFNAME}" \
con-name ${CON_NAME} \
autoconnect yes \
ssid "${CON_NAME}" \
802-11-wireless.mode ap \
@sulincix
sulincix / sandbox.sh
Created December 23, 2022 13:13
Sandbox with bubblewrap
#!/bin/bash
if ! which "$1" &> /dev/null ; then
exit 127
fi
xhost +local:
mkdir -p "$HOME/.sandbox/home/$1"
exec env -i DISPLAY=$DISPLAY PULSE_SERVER=127.0.0.1 bwrap --bind / / \
--dev /dev \
--tmpfs /tmp --tmpfs /dev/shm \
--bind /dev/dri /dev/dri \
@sulincix
sulincix / main.py
Created November 15, 2022 13:37
PyQt5 rtsp viewer
#/usr/bin/env python3
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtCore import QDir, Qt, QUrl, QSize
from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer
from PyQt5.QtMultimediaWidgets import QVideoWidget
from PyQt5.QtWidgets import (QApplication, QVBoxLayout, QWidget, QLabel)
# https://doc.qt.io/qtforpython-5/PySide2/QtMultimedia/QMediaPlayer.html
class VideoPlayer(QWidget):
@sulincix
sulincix / Dockerfile
Created September 21, 2022 13:07
pardus-docker
# docker build -t pardus:yirmibir .
FROM debian:bullseye
RUN apt update
RUN echo "deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free" > /etc/apt/sources.list
RUN apt update --allow-insecure-repositories
RUN apt install pardus-archive-keyring ca-certificates --allow-unauthenticated -y
RUN echo "deb http://depo.pardus.org.tr/pardus yirmibir main non-free contrib" > /etc/apt/sources.list
RUN echo "# deb-src http://depo.pardus.org.tr/pardus yirmibir main non-free contrib" >> /etc/apt/sources.list
RUN echo "" >> /etc/apt/sources.list
RUN echo "deb http://depo.pardus.org.tr/guvenlik yirmibir main non-free contrib" >> /etc/apt/sources.list
@sulincix
sulincix / deepfreeze.sh
Created September 19, 2022 12:35
Universal deepfreeze linux
#!/bin/bash
if [[ -e /sbin/init-normal ]] ; then
exit
fi
mv /sbin/init /sbin/init-normal
cat > /sbin/init <<EOF
#!/bin/bash
mount -t tmpfs tmpfs /tmp || true
mkdir -p /tmp/work/source /tmp/work/a /tmp/work/b /tmp/work/target || true
mount --bind / /tmp/work/source
@sulincix
sulincix / shc.c
Created August 3, 2022 15:34
Sh compiler
#!/bin/bash
if [[ $# -ne 2 ]] ; then
echo "Usage shc (source.sh) (output.c)"
exit 2
fi
echo "#include <stdlib.h>" > "$2"
echo "int main(){" >> "$2"
echo " return system(\" \\" >> "$2"
cat $1 | sed 's/\\/\\\\/g;s/"/\\"/g;s/$/\\/g' >> "$2"
echo " \");" >> "$2"