Skip to content

Instantly share code, notes, and snippets.

Schlomo Schapiro schlomo

Block or report user

Report or block schlomo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@schlomo
schlomo / sshrc
Last active Aug 29, 2015
SSH RC script that helps me with reconnected screen sessions and deploys my personal environment
View sshrc
#!/bin/bash
# xauth handling, code adapted from sshd(8)
if type -p xauth >/dev/null && read proto cookie && [[ "$DISPLAY" ]]; then
if [[ "${DISPLAY:0:10}" = 'localhost:' ]] ; then
# X11UseLocalhost=yes
#echo add unix:"${DISPLAY:11}" $proto $cookie #### egrehm changed to :10 because seems to be broken on rhel6 and clones
echo add unix:"${DISPLAY:10}" $proto $cookie
else
# X11UseLocalhost=no
echo add "$DISPLAY" $proto $cookie
View ssh_config_patch.sh
sed -i -f - /etc/ssh/sshd_config <<EOF
1{
i # this content comes from the %{name}-%{version}-%{release} package
i AddressFamily inet
i Protocol 2
i LogLevel VERBOSE
i HostbasedAuthentication yes
i IgnoreUserKnownHosts yes
i IgnoreRhosts yes
i Banner /etc/ssh/banner.txt
@schlomo
schlomo / httpd_replace_config.sh
Created May 2, 2014
Replace httpd.conf with list of includes
View httpd_replace_config.sh
if ! echo '# HTTPD conf framework. Will be overwritten to this content on each install of the rpm package!!!
# This file is managed by %{name}-%{version}-%{release}
ServerRoot "/etc/httpd"
Include conf/basic/*.conf
Include conf/main/*.conf
Include conf/other/*.conf
' >/etc/httpd/conf/httpd.conf ; then
logger -p user.err -s -t %name -- "ERROR: Could not replace content of '/etc/httpd/conf/httpd.conf'"
fi
View is24.directory
[Desktop Entry]
Version=1.0
Type=Directory
Icon=is24-applications
Name=IS24
Comment=IS24 tools and utilities
Comment[de]=IS24 Werkzeuge und Hilfsmittel
View IS24.menu
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">
<Menu>
<Name>Applications</Name>
<Menu>
<Name>Network</Name>
<Exclude>
<Or>
<Category>X-IS24</Category>
<Filename>exo-mail-reader.desktop</Filename>
View is24-vpngui.desktop
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=IS24 VPN Client for SSLGW
Comment=Use to connect the VPN with a simple GUI
Exec=is24vpn-gui
Terminal=false
Icon=is24vpngui
Type=Application
Categories=Network;X-IS24;
@schlomo
schlomo / demo1.ipxe
Last active Aug 29, 2015
iPXE system inventarisation demo for Linux Magazin article. See https://docs.google.com/forms/d/1_wIEKGIMbSX1Qd5JqpaM_vLGglsl_rCOCB8SNJqHCtw/viewanalytics for results
View demo1.ipxe
#!ipxe
imgload https://docs.google.com/forms/d/1_wIEKGIMbSX1Qd5JqpaM_vLGglsl_rCOCB8SNJqHCtw/formResponse?entry.1027223351=${uuid}&entry.1507713783=${asset}&entry.46865035=${manufacturer}&entry.2129135320=${product}&entry.1181250351=${serial}&entry.2095563838=${mac}&entry.615831042=${chip} && echo Thank you for participating ||
sanboot --no-describe --drive 0x80 || shell
@schlomo
schlomo / demo2.ipxe
Last active Aug 29, 2015
iPXE protected installation menu demo
View demo2.ipxe
#!ipxe
console -x 800 -y 600 --picture http://www.linux-magazin.de/extension/lnm/design/linux_magazin/images/lm_logo_online.png --top 350
:menu
menu Was moechten Sie jetzt machen?
item --key n local Normaler Systemstart
item --gap Fuer den Systemverwalter
item --key i install Installationsmenue aufrufen
item --key d diag PC-Diagnose starten
item --key r reboot Neu starten
@schlomo
schlomo / login.php
Last active Aug 29, 2015
PHP Basic Auth Gateway. Requests basic auth (password is reversed username) and redirects to URL passed as query string
View login.php
<?php
$username = 1;
$revpwd = 0;
if (isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['PHP_AUTH_PW'])) {
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
$revpwd = strrev($password);
}
if ($username == $revpwd) {
if (isset($_SERVER['QUERY_STRING'])) {
You can’t perform that action at this time.