all repos — dotfiles @ b5b1f46db835b595d2c471e0c370fbcdaeaf9d2e

linux dotfiles

add couple of scripts
Prithu Goswami prithugoswami524@gmail.com
Tue, 22 Dec 2020 22:15:00 +0530
commit

b5b1f46db835b595d2c471e0c370fbcdaeaf9d2e

parent

f927553e24aabf639386dbea56a72a7c6b11e70d

2 files changed, 175 insertions(+), 0 deletions(-)

jump to
A bin/misc/compile_lmm_rest_doc

@@ -0,0 +1,117 @@

+#!/bin/sh + +git log -1 --date='rfc' --format='<br><br><br><hr>Last modified by %an - %ad - commit %h' README.md | cat README.md - > pre.md + +pandoc -o pre.html -f markdown+multiline_tables pre.md + +cat <<EOF - pre.html > index.html +<html> +<head> + <link rel="stylesheet" href="https://fonts.xz.style/serve/inter.css"> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css"> + <link rel="stylesheet" href="https://newcss.net/theme/night.css"> + <title>LMM Counsellor REST API Documentation</title> + <style> + code{white-space: pre-wrap;} + span.smallcaps{font-variant: small-caps;} + span.underline{text-decoration: underline;} + div.column{display: inline-block; vertical-align: top; width: 50%;} + div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} + ul.task-list{list-style: none;} + pre > code.sourceCode { white-space: pre; position: relative; } + pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } + pre > code.sourceCode > span:empty { height: 1.2em; } + code.sourceCode > span { color: inherit; text-decoration: inherit; } + div.sourceCode { margin: 1em 0; } + pre.sourceCode { margin: 0; } + @media screen { + div.sourceCode { overflow: auto; } + } + @media print { + pre > code.sourceCode { white-space: pre-wrap; } + pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } + } + pre.numberSource code + { counter-reset: source-line 0; } + pre.numberSource code > span + { position: relative; left: -4em; counter-increment: source-line; } + pre.numberSource code > span > a:first-child::before + { content: counter(source-line); + position: relative; left: -1em; text-align: right; vertical-align: baseline; + border: none; display: inline-block; + -webkit-touch-callout: none; -webkit-user-select: none; + -khtml-user-select: none; -moz-user-select: none; + -ms-user-select: none; user-select: none; + padding: 0 4px; width: 4em; + background-color: #232629; + color: #7a7c7d; + } + pre.numberSource { margin-left: 3em; border-left: 1px solid #7a7c7d; padding-left: 4px; } + div.sourceCode + { color: #cfcfc2; background-color: #232629; } + @media screen { + pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } + } + code span { color: #cfcfc2; } /* Normal */ + code span.al { color: #95da4c; background-color: #4d1f24; font-weight: bold; } /* Alert */ + code span.an { color: #3f8058; } /* Annotation */ + code span.at { color: #2980b9; } /* Attribute */ + code span.bn { color: #f67400; } /* BaseN */ + code span.bu { color: #7f8c8d; } /* BuiltIn */ + code span.cf { color: #fdbc4b; font-weight: bold; } /* ControlFlow */ + code span.ch { color: #3daee9; } /* Char */ + code span.cn { color: #27aeae; font-weight: bold; } /* Constant */ + code span.co { color: #7a7c7d; } /* Comment */ + code span.cv { color: #7f8c8d; } /* CommentVar */ + code span.do { color: #a43340; } /* Documentation */ + code span.dt { color: #2980b9; } /* DataType */ + code span.dv { color: #f67400; } /* DecVal */ + code span.er { color: #da4453; text-decoration: underline; } /* Error */ + code span.ex { color: #0099ff; font-weight: bold; } /* Extension */ + code span.fl { color: #f67400; } /* Float */ + code span.fu { color: #8e44ad; } /* Function */ + code span.im { color: #27ae60; } /* Import */ + code span.in { color: #c45b00; } /* Information */ + code span.kw { color: #cfcfc2; font-weight: bold; } /* Keyword */ + code span.op { color: #cfcfc2; } /* Operator */ + code span.ot { color: #27ae60; } /* Other */ + code span.pp { color: #27ae60; } /* Preprocessor */ + code span.re { color: #2980b9; background-color: #153042; } /* RegionMarker */ + code span.sc { color: #3daee9; } /* SpecialChar */ + code span.ss { color: #da4453; } /* SpecialString */ + code span.st { color: #f44f4f; } /* String */ + code span.va { color: #27aeae; } /* Variable */ + code span.vs { color: #da4453; } /* VerbatimString */ + code span.wa { color: #da4453; } /* Warning */ + </style> +</head> +<body> +EOF + +echo "</body></html>" >> index.html + +sed -i '/^<h1 id="rest-api-doc/i<header>' index.html +sed -i '/^<h1 id="rest-api-doc/a</header>' index.html +rm pre.html pre.md +# mv index.html ../ + +cat README.md | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g' > content + +cat <<EOF > payload +{ + "description": "REST API docs for LMM Counsellor App", + "files": { + "REST API Counsellor.md": { + "content": "`cat content`", + "filename": "REST API Counsellor.md" + } + } +} +EOF + +# curl -s -X PATCH\ +# -H 'Authorization: token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\ +# -d@payload\ +# https://api.github.com/gists/c1b86bac8046770f8718d60e120f92ea > /dev/null 2>&1 + +rm payload content
A bin/scripts/ab.py

@@ -0,0 +1,58 @@

+#!/usr/bin/env python3 +# This bot sends any sound it receives back to where it has come from. +# WARNING! Don't put two bots in the same place! + +import pymumble_py3 +import time +from pymumble_py3.callbacks import PYMUMBLE_CLBK_SOUNDRECEIVED as PCS +from simple_term_menu import TerminalMenu + + + +pwd = "" # password +server = "omkarona.wtf" +nick = "AmongUsBot" +cert_file="/home/prithu/.local/share/amongusbot/cert.pem" +key_file="/home/prithu/.local/share/amongusbot/key.pem" + + +def sound_received_handler(user, soundchunk): + # sending the received sound back to server + mumble.sound_output.add_sound(soundchunk.pcm) + + +mumble = pymumble_py3.Mumble(server, nick, password=pwd, keyfile=key_file, certfile=cert_file) +mumble.start() +mumble.is_ready() + +channel = mumble.channels.find_by_name('Among Us') +dead_channel = mumble.channels.find_by_name('Dead') +channel.move_in() + + +while True: + s = input("> ") + if (s == "u"): + users = channel.get_users() + users.remove(mumble.users.myself) + for u in users: + u.unmute() + elif (s == "m"): + users = channel.get_users() + users.remove(mumble.users.myself) + for u in users: + u.mute() + elif (s == "d"): + user_strings = [] + users = channel.get_users() + users.remove(mumble.users.myself) + for u in users: + user_strings.append(u['name']) + if(users): + user_selected_index = TerminalMenu(user_strings, search_key=None).show() + if(user_selected_index): + users[user_selected_index].unmute() + dead_channel.move_in(session=users[user_selected_index]['session']) + elif (s == "r"): + for u in dead_channel.get_users(): + channel.move_in(session=u['session'])