Skip to content

Instantly share code, notes, and snippets.

View chrosta's full-sized avatar
😐
Nothing.

Chrosta chrosta

😐
Nothing.
View GitHub Profile
IFS=$'\n'; LOG='XXX.log' DIV='^2022'; BLOCK=''; for LINE in $(cat $LOG); do if [[ $(echo $LINE | egrep "$DIV" | wc -l) == 1 ]]; then echo $BLOCK; BLOCK="--> $LINE"; else BLOCK="$BLOCK|$(echo $LINE | xargs)"; fi; done
@chrosta
chrosta / screenrc
Created March 2, 2022 14:25
Linux screen settings.
###
# My settings for ".screenrc".
#--
# No bells, tabs line settings, window captioning and CTRL+a remap to CTRL+b.
###
vbell off
vbell_msg ''
termcapinfo * vb=:
caption always "%{= kw}%-w%{= bW}%n %t%{-}%+w %-= %c:%s|%Y-%m-%d"
hardstatus string "[%t%?] %h %?]"
/***
* Set typically into [~/.config/gtk-3.0/gtk.css] file.
* 1. Window headerbar size and closebutton for GTK3+ apps.
***/
window headerbar.default-decoration {
padding-top: 8px;
padding-bottom: 8px;
padding-right: 8px;
padding-left: 8px;
min-height: 20px;
IFS=$'\n'; BLOCK=""; for LINE in $(cat ~/glassfishv3/glassfish/domains/domain1/logs/server.log); do BLOCK="$BLOCK|$(echo $LINE | xargs)"; if [ "$LINE" = "|#]" ]; then echo $BLOCK | sed 's/^\|//g' | sed 's/\|\|/|/g'; BLOCK=""; fi; done;
/*** Restart of work on FF styling, tabs stack fixed. ***/
#tabbrowser-tabs {
margin-left: 2px !important;
}
#tabbrowser-tabs[haspinnedtabs]:not([positionpinnedtabs]) > #tabbrowser-arrowscrollbox > .tabbrowser-tab[first-visible-unpinned-tab] {
margin-inline-start: 0px !important;
}
import re
class Parent(object):
def __init__(self):
self.name = re.sub(r'\W.*', "", re.sub(r'.*\.', "", str(self)))
self.pointer = re.search(r'\ 0x.*\W', str(self)).group(0).replace(' 0x', "").replace('>', "")
self.instance = self.name + "@" + self.pointer
def out(self, text='???'):
print self.instance + ": " + text
for IP in $(cat IP.text | sort | uniq); do if [ $(nslookup $IP | egrep "^Name:" | wc -l) -eq "1" ]; then DN=$(nslookup $IP | egrep "^Name:" | sed 's/.*\ //g'); else DN="NA"; fi; echo "${IP//[$'\t\r\n']} ${DN//[$'\t\r\n']}"; done 2>/dev/null
/***
* Your Stylesheet
*--
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*--
* Add your own CSS or Less to fully customize Atom. But if you are unfamiliar
* with Less, you can read more about it here [http://lesscss.org].
***/
###
# Variace na renesanční téma, aneb reverze prvků seznamu pomocí FP v Pythonu.
#--
# 1. Vraci nový (v původním SEZNAM zůstává) seznam s přeházenými prvky.
# 2. Tohle není FP (ale hezčí třeba pro použít v kódu), upravuje SEZNAM.
# 3. Použití MAP a LAMBDA, upravuje SEZNAM (v náročnosti na systémové
# prostředky to může být k diskuzi, protože MAP vrátí seznam prvků None).
# 4. Dobrá obdoba příkladu 3 s MAP a LAMBDA, výsledkem MAP je nový seznam
# přeházených prvnů (původní SEZNAM zůstává). Elegancí odpovídá příkladu 1.
# 5. To samé, co je v příkladu 3, takže pokud to potřebujete nějak takhle, je
for I in `find . -type f | egrep "\.text$|\.py$"`; do for J in `cat $I | tr -cs '[:alnum:]' "\n"`; do if [ ${#J} -gt 2 ]; then echo $J; fi; done; done | sort | uniq | egrep -v "á|č|ď|é|ě|í|ň|ó|ř|š|ť|ú|ů|ý|ž|Á|Č|Ď|É|Ě|Í|Ň|Ó|Ř|Š|Ť|Ú|Ů|Ý|Ž"