Skip to content

Instantly share code, notes, and snippets.

View trappedinspacetime's full-sized avatar
🏠
Working from home

Kenn trappedinspacetime

🏠
Working from home
  • For Personal Use
  • Istanbul
View GitHub Profile
#!/usr/bin/env python3
# taken from https://github.com/s-zeid/bin/blob/main/display-transparent
"""Displays an image without a window border or background.
Based on code from http://bit.ly/qfvule
"""
import argparse
import os
@trappedinspacetime
trappedinspacetime / limitcpu.sh
Created May 5, 2022 20:08
limit chromium cpu
while true; do cpulimit -p $( while true ; do if [[ ! -z $(pstree -p -a | awk '/chromium-browser/ && !/awk/' | grep -oP "(?<=sh,).*[0-9]+") ]]; then echo "$(pstree -p -a | awk '/chromium-browser/ && !/awk/' | grep -oP "(?<=sh,).*[0-9]+")"; break; fi; sleep 2; done ) -l 60; done
@trappedinspacetime
trappedinspacetime / prayer_times_tr.py
Created April 20, 2022 13:06
prayer times close to Turkish Diyanet's calculation
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import math
import re
import pytz
import datetime
from datetime import datetime as dt
from datetime import datetime as dtm, time as datetime_time, timedelta
#from _datetime import *
"""
@trappedinspacetime
trappedinspacetime / cal.lua
Created April 3, 2022 14:17 — forked from meskarune/cal.lua
conky calendar and weather
#!/usr/bin/env lua
conky_color = "${color1}%2d${color}"
t = os.date('*t', os.time())
year, month, currentday = t.year, t.month, t.day
daystart = os.date("*t",os.time{year=year,month=month,day=01}).wday
month_name = os.date("%B")
#!/usr/bin/env -S bash -e
# REPO='https://gitlab.gnome.org/GNOME/vte.git'
REPO='https://github.com/GNOME/vte.git'
LIBPATH='/usr/local/lib/x86_64-linux-gnu'
LDCONFPATH='/etc/ld.so.conf'
# See Deps:
# https://github.com/GNOME/vte/blob/master/meson.build
# On Ubuntu 21.04, GNOME-Terminal 3.38.1:
@trappedinspacetime
trappedinspacetime / gist:3eb5a619638b1ed3e1736477e58605e0
Created January 9, 2022 11:47
rofi -dump-config and rofi -dump-theme
rofi -dump-config
configuration {
/* modi: "window,run,ssh";*/
/* font: "mono 12";*/
/* location: 0;*/
/* yoffset: 0;*/
/* xoffset: 0;*/
/* fixed-num-lines: true;*/
/* show-icons: false;*/
/* terminal: "rofi-sensible-terminal";*/
// gcc test.c -lX11 -lXext
/* Some clumsy app to test X11 Shape extension.
*
* The app window consists of three zones:
* +-------+
* | A |
* +---+---+
* | B | C |
* +---+---+
*
@trappedinspacetime
trappedinspacetime / hello_world.asm
Created October 15, 2021 16:17
Hello World in assembly
; hello_world.asm
;
; Author: John Hammond
global _start
section .text:
_start:
mov eax, 0x4 ; use the write syscall
mov ebx, 1 ; use the stdout as fd
@trappedinspacetime
trappedinspacetime / xtext.c
Created August 11, 2021 16:28
print transparent text on the screen
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/Xfixes.h>
#include <pango/pangocairo.h>
#include <cairo.h>
@trappedinspacetime
trappedinspacetime / traffic.sh
Created August 11, 2021 15:51
bash system monitor
#!/bin/bash
#shows the current io usage
function iomonitor {
OLD=`awk '{print $1}' /sys/block/sda/stat` # First field is number of read I/Os processed
DT=1
for i in /sys/block/sda/stat
do
sleep $DT
NEW=`awk '{print $1}' /sys/block/sda/stat`