Skip to content

Instantly share code, notes, and snippets.

View yradunchev's full-sized avatar

Yordan Radunchev yradunchev

View GitHub Profile
@yradunchev
yradunchev / unmedia.txt
Last active June 4, 2020 02:05
unmedia.txt
20170204
--------
19min.bg
1kam1.eu
30dumi.eu
afera.bg
alterinformation.wordpress.com
anonybulgaria.wordpress.com
bez-cenzura.com
bezpartien.com
@yradunchev
yradunchev / check_server_room_temp
Created December 12, 2015 15:13
Check Server Room temperature by reading server temp sensors with IPMI over iDRAC
ipmitool -H 10.10.10.10 -U user -P pass -I lanplus -L user sdr get Inlet\ Temp | grep Sensor\ Reading | sed -r 's/([^0-9]*([0-9]*)){1}.*/\2/'
@yradunchev
yradunchev / cpgrp.sh
Last active May 10, 2016 04:56
Copy group membership from one account to another
#!/bin/bash
#
# Copy group membership from one account to another
function yes_no() {
read -p "$1 ([y]es or [N]o): "
case $(echo $REPLY | tr '[A-Z]' '[a-z]') in
y|yes) echo "yes" ;;
*) echo "no" ;;
esac
@yradunchev
yradunchev / ldap.conf
Created April 6, 2017 09:49 — forked from jirutka/ldap.conf
Simple script for OpenSSH server to load authorization keys from LDAP. It requires just POSIX shell and ldapsearch utility. To manage keys in LDAP, use https://github.com/jirutka/ssh-ldap-pubkey.
# /etc/ssh/ldap.conf
# See ldap.conf(5) for details
# This file should be world readable but not world writable.
BASE ou=People,dc=example,dc=org
URI ldap://localhost
@yradunchev
yradunchev / vhostadd
Created May 22, 2017 15:03
script to create local user + vhost + cgi + suexec
#!/bin/bash -
#===============================================================================
#
# FILE: vhostadd
#
# USAGE: ./vhostadd -n UserName -p Password -d FQDN
#
# DESCRIPTION:
#
# OPTIONS: ---
@yradunchev
yradunchev / t
Created May 27, 2017 06:34
tricks
# Backup filesystem perms:
getfacl -R / > /tmp/perms.txt
# Restore filesystem perms:
setfacl --restore=/tmp/perms.txt
@yradunchev
yradunchev / .screenrc
Last active January 14, 2021 17:11
Show laptop battery status in GNU Screen terminal multiplexer
startup_message off
screen -t bash1 0
screen -t bash2 1
select 0
altscreen on
term screen-256color
bind ',' prev
bind '.' next
vbell off
defscrollback 5000
@yradunchev
yradunchev / unfavorite.js
Created June 12, 2017 20:33 — forked from ashander/unfavorite.js
Delete all your favorites (unfavorite or unlike every tweet) on twitter.com (thx to @JamieMason and @b44rd for inspiring this)
// 1. Go to https://twitter.com/i/likes
// 2. Keep scrolling to the bottom repeatedly until all your favs are loaded.
// 3. Run this in your console (open in chrome by View > Developer > JavaScript Console)
// Notes: this may take a while if you have a lot of favs/likes
// you can only access your most recent ~2000 likes.
// inspired by https://gist.github.com/JamieMason/7580315
$('.ProfileTweet-actionButtonUndo').click()
@yradunchev
yradunchev / blckurl
Last active June 25, 2017 04:31
block site if it is not blocked but unblock it if it is already blocked using hosts file
#!/bin/bash
readonly HOSTSFILE='/etc/hosts'
readonly COMMENTCHR='#'
readonly URLS=( \
'0.0.0.0 facebook.com' \
'0.0.0.0 twitter.com' \
'0.0.0.0 www.facebook.com' \
'0.0.0.0 www.twitter.com' \
)
@yradunchev
yradunchev / blockfs
Last active July 30, 2017 20:19
block access to sites with cron and unbound
#!/bin/bash
readonly UCONF='/etc/unbound/unbound.conf'
# toggle block on/off, kill chromium, restart unbound
awk -v commentId='#' -v word='include: /etc/unbound/block.conf' '
$0 ~ "(^|[[:punct:][:space:]])" word "($|[[:punct:][:space:]])" {
if (match($0, "^[[:space:]]*" commentId)) {
$0 = substr($0, RSTART + RLENGTH);
system("pkill --oldest chromium")