Skip to content

Instantly share code, notes, and snippets.

<VirtualHost *:8011>
DocumentRoot /var/www/html/
ServerName example.com
ServerAlias www.example.com
ServerAdmin root@example.com
ErrorLog logs/www.example.com-error_log
CustomLog logs/www.example.com-access_log common
</VirtualHost>
@rytoj
rytoj / examples.py
Created March 24, 2018 10:28
python examples
# List complehensions zipping elements
ranks
['2', '3', '4', '5', '6', '7', '8', '9', '10', '11', 'J', 'Q', 'K', 'A']
suits
['spades', 'diamonds', 'clubs', 'heats']
[(rank, suit) for rank in ranks for suit in suits]
[('2', 'spades'), ('2', 'diamonds'), ('2', 'clubs'), ('2', 'heats'), ('3', 'spades'), ('3', 'siamonds'), ('3', 'clubs'), ('3', 'heats'), ('4', 'spades'), ('4', 'siamonds'), ('4', 'clubs'), ('4', 'heats'), ('5', 'spades'), ('5', 'siamonds'), ('5', 'clubs'), ('5', 'heats'), ('6', 'spades'), ('6', 'siamonds'), ('6', 'clubs'), ('6', 'heats'), ('7', 'spades'), ('7', 'siamonds'), ('7', 'clubs'), ('7', 'heats'), ('8', 'spades'), ('8', 'siamonds'), ('8', 'clubs'), ('8', 'heats'), ('9', 'spades'), ('9', 'siamonds'), ('9', 'clubs'), ('9', 'heats'), ('10', 'spades'), ('10', 'siamonds'), ('10', 'clubs'), ('10', 'heats'), ('11', 'spades'), ('11', 'siamonds'), ('11', 'clubs'), ('11', 'heats'), ('J', 'spades'), ('J', 'siamonds'), ('J', 'clubs'), ('J', 'heats'), ('Q', 'spades'), ('Q', 'siamonds'), ('Q', 'clubs')
04fdd136f1e31394a8c833b66cacfe9e23f8147d020ecbbd917ffc4e9cb5417a2493ef1a300604fb5721809e88863f84d242f17c0924a6bdaf3f5a45ec689b2215
@rytoj
rytoj / sysinfo
Created December 12, 2016 14:27
#!/bin/bash
# Program to output a system information page
TITLE="System Information Report for $HOSTNAME"
TIME=$(date +%F:%T)
TIMESTAMP="Generated $TIME, by $USER uid: $(id -u)"
TOTALSPACE=$(df -h)
SELIUX_STATE=$(sestatus | head -1 ; sestatus | grep --color=auto "Current mode";)
LARGEST_FILES=$(du -a /home 2>/dev/null | sort -n -r | head -n 10)
type systemd 2>/dev/null && SERVICES=$(systemctl -t service) || SERVICES=$(chkconfig --list) #for cebos6.8
#!/bin/bash
# iptables - usefull rules and more
printf "1. IP praleidimas"
printf "2. ssh praleidimas"
printf "3. http ir https praleidimas:"
printf "4. blokavimas per pietų pertrauką:"
printf "5. minimali ddos apsauga:"
printf "6. Praleidziam localhost:"
@rytoj
rytoj / bash_if_&_loop.sh
Last active December 19, 2016 22:04
bash if examples
#!/bin/bash
Reading
####################################
read -e -p "Enter value: " value # saves read input to var, $value
read -n 1 -p "Type a character > " #reads one character saves to default read var $REPLY
Cheking
####################################
@rytoj
rytoj / tetris.desktop
Created June 17, 2016 13:14
Unity desktop link to binary, works with http links also
[Desktop Entry]
Encoding=UTF-8
Name=Game
Type=Link
URL=/usr/games/kblocks
Icon=/home/user/Pictures/inc/tetris-64x64.png
Name[en_US]=Tetris game
@rytoj
rytoj / nested_sum.py
Last active June 14, 2016 19:14
nested_sum
#!/usr/bin/python3
T = ["abc",1, 10, [3,2,5], 20, [5,5], "50" ]
newList=[]
def nested_sum(newstedList):
'''
newstedList: list composed of nested lists containing int.
newlist: New flat list composed of list elements.
'''
#most used commands
history | awk 'BEGIN {FS="[ \t]+|\\|"} {print $3}' | sort | uniq -c | sort -nr | head
#Text to hex
echo "Labas" | od -t x1
#!/bin/bash
#for testing
#notify-send -u critical "$(xsel -o)"
echo "$(xsel -o)" | espeak