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
@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`
watch --difference=cummulative --interval=1 '(echo device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue; for file in /sys/block/*/stat; do echo -n $file; cat $file; done) | column -t'
# OUTPUTS:
#device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue
#/sys/block/dm-0/stat 116962 0 2212746 314096 7705653 0 150218536 609670232 0 644428 610921004
#/sys/block/dm-1/stat 116479 0 2208882 313324 7686986 0 150218536 609676068 0 644616 611418072
#/sys/block/dm-2/stat 302 0 2416 780 0 0 0 0 0 148 780
#/sys/block/sda/stat 91181 26273 2217246 74876 7314854 388030 150261802 16954364
@trappedinspacetime
trappedinspacetime / youtube-search.sh
Last active June 8, 2021 11:52
search youtube in mpv using mpv-gallery-view script
#!/bin/bash
if xdotool search --class "mpv"; then
echo "process exists"
scbc=$(zenity --entry --title="Youtube" --text="searching for:")
[[ "$?" != "0" ]] && exit 1
echo "{ \"command\": [\"loadfile\", \"ytdl://ytsearch100:$scbc\" ] }" | socat - /tmp/mpvsocket
else
echo "process not exists"
coproc mpv
@trappedinspacetime
trappedinspacetime / gist:8eb3c26e1028a1c2fbb6a8d6998710af
Created May 16, 2021 20:06 — forked from kui/gist:2622504
get the active window on X window system.
// -*- coding:utf-8-unix; mode:c; -*-
//
// get the active window on X window system
//
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <X11/Xlib.h> // `apt-get install libx11-dev`