Skip to content

Instantly share code, notes, and snippets.

BeanSecurity / 1.go
Created Oct 9, 2019
View 1.go
package main
import (

Keybase proof

I hereby claim:

  • I am beansecurity on github.
  • I am beansecurity ( on keybase.
  • I have a public key ASB1rvH_3jzsYK9CUeI5JSrucO3unwCiDL-aDeFTDY2JvQo

To claim this, I am signing this object:

BeanSecurity / getxkblayout.c
Last active Oct 5, 2019 — forked from fikovnik/getxkblayout.c
Get keyboard layout using X11
View getxkblayout.c
// compile with `gcc -I/usr/include getxkblayout.c -lX11 -lxkbfile -o /usr/local/bin/getxkblayout`
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);
BeanSecurity / spacemacs-autoswitch-layouts.el
Created Aug 19, 2019
Smart auto switch layouts for insert and normal modes (Spacemacs+xkb)
View spacemacs-autoswitch-layouts.el
(setq shell-switch-lang "xte 'keydown Shift_L' 'keydown Shift_R' 'keyup Shift_L' 'keyup Shift_R'") ;; shell command that switch layouts emulating setxkbmap toggle keybind (left Shift+right Shift for me)
;; 'xte' from 'xautomation' package
(setq get-current-lang (lambda () (substring (shell-command-to-string "getxkblayout") 0 2))) ;; get C script 'getxkblayout' and compile from my gist
(setq-default prev-lang (funcall get-current-lang)) ;; save previous layout
(add-hook 'evil-insert-state-entry-hook ;; change layout whiforle insert mode starting if its not similar to previous
(lambda ()
(if (not (equal prev-lang
(funcall get-current-lang)))
(shell-command shell-switch-lang))))
(add-hook 'evil-insert-state-exit-hook ;; change layout to default(eng) exiting insert mode
BeanSecurity /
Created Feb 19, 2019 — forked from raydrezack/
Sample Python script to employ RTSP/RTP to play a stream from an IP-cam (from stackoverflow)
A demo python code that ..
1) Connects to an IP cam with RTSP
2) Draws RTP/NAL/H264 packets from the camera
3) Writes them to a file that can be read with any stock video player (say, mplayer, vlc & other ffmpeg based video-players)
Done for educative/demonstrative purposes, not for efficiency..!