Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@BeanSecurity
BeanSecurity / rtsp-rtp-sample.py
Created February 19, 2019 08:13 — forked from raydrezack/rtsp-rtp-sample.py
Sample Python script to employ RTSP/RTP to play a stream from an IP-cam (from stackoverflow)
"""
http://stackoverflow.com/questions/28022432/receiving-rtp-packets-after-rtsp-setup
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..!
@BeanSecurity
BeanSecurity / spacemacs-autoswitch-layouts.el
Created August 19, 2019 23:39
Smart auto switch layouts for insert and normal modes (Spacemacs+xkb)
(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

Keybase proof

I hereby claim:

  • I am beansecurity on github.
  • I am beansecurity (https://keybase.io/beansecurity) on keybase.
  • I have a public key ASB1rvH_3jzsYK9CUeI5JSrucO3unwCiDL-aDeFTDY2JvQo

To claim this, I am signing this object:

@BeanSecurity
BeanSecurity / getxkblayout.c
Last active October 5, 2019 13:56 — forked from fikovnik/getxkblayout.c
Get keyboard layout using X11
// 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
BeanSecurity / 1.go
Created October 9, 2019 23:51
Тестовое
package main
import (
"bufio"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
)