Skip to content

Instantly share code, notes, and snippets.

View sulincix's full-sized avatar
🇹🇷

​​ sulincix

🇹🇷
View GitHub Profile
@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"
@sulincix
sulincix / purge.sh
Last active February 26, 2024 11:20
nonfree-cleaner (debian)
#!/usr/bin/bash
dpkg-query -W -f='${Section}\t${Package}\n' | grep ^non-free | sed "s/.*\t//g" | xargs apt purge -y
pkg=""
set -e
export LANG=C
apt-cache policy $(apt list --installed | sed "s/\/.*//g") | while read line ; do
if echo "$line" | grep "^[a-zA-Z0-9-]*:$" >/dev/null ; then
pkg=$(echo $line | sed "s/://g")
elif echo $line | grep "non-free" >/dev/null ; then
echo $pkg
@sulincix
sulincix / tinywm.c
Created June 10, 2022 22:04
my customized tinywm code
/* TinyWM is written by Nick Welch <nick@incise.org> in 2005 & 2011.
* Modified by Ali Rıza KESKİN in 2019-?
*
* This software is in the public domain
* and is provided AS IS, with NO WARRANTY. */
#include <X11/Xlib.h>
#include <stdlib.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))