Skip to content

Instantly share code, notes, and snippets.

View shaposhnikoff's full-sized avatar
🏠
Working from home

Shaposhnikoff shaposhnikoff

🏠
Working from home
  • Kiev,Ukraine
  • 02:50 (UTC +02:00)
View GitHub Profile
#!/bin/bash
ZABBIX_SENDER="/usr/local/sbin/zabbix_sender"
ZABBIX_TRAPPER="187.61.6.226"
ZABBIX_TRAPPER_PORT=10051
ZABBIX_ITEM_KEY_PREFIX="memcached_"
ZABBIX_HOST="Memcached"
MEMCACHED_SERVER="localhost"
MEMCACHED_SERVER_PORT=11211
STATS=`(sleep 1 ; echo "stats"; sleep 1; echo "quit") | telnet $MEMCACHED_SERVER $MEMCACHED_SERVER_PORT`
STAT //' | sed -e 's/ /:/g' | sed -e 's/:STAT:/\n/g')
@kennethreitz
kennethreitz / sync.py
Created October 10, 2010 19:08
GitHub Syncer. Clones or Pulls all GitHub repos (including watched list).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Kenneth Reitz's GitHub Syncer
This script uses the GitHub API to get a list of all forked, mirrored, public, and
private repos in your GitHub account. If the repo already exists locally, it will
update it via git-pull. Otherwise, it will properly clone the repo.
It will organize your repos into the following directory structure:
@chrisglass
chrisglass / Apache-LDAP-Authentication
Created October 19, 2010 12:09
An example of how to configure apache to work with LDAP authentication
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from All
</Directory>
@terrettaz
terrettaz / psql_benchmark.bash
Created November 21, 2010 15:28
A simple script to do some benchmark on postgresql
#!/bin/bash
DATABASE="benchmark_test_db"
TMP_DIR=/tmp
if [ ! -x "`which psql`" ]; then
echo "psql check failed: postgsql is needed"
exit 1
fi
@fernandoaleman
fernandoaleman / rpm-from-source.sh
Created November 18, 2011 16:34
How to create an RPM from source with spec file
# How to create an RPM from source with spec file
# This is for Redhat versions of linux. Sometimes when you search for an rpm package,
# it is either outdated or not available. The only thing available is the source code.
# You can create a custom RPM package from source.
#
# For this example, I'll be using the latest version of Git, currently v.1.7.7.3
# Step: 1
# Install rpmbuild
@fernandoaleman
fernandoaleman / how-to-create-an-rpm-repository.sh
Created November 18, 2011 17:57
How to create an RPM repository
# How to create an RPM repository
# This is for Redhat 64 bit versions of Linux. You can create your own RPM repository # to host your custom RPM packages.
#
# See "How to create an RPM from source with spec file" for more information.
# https://gist.github.com/1376973
# Step: 1
# Install createrepo
@kylewest
kylewest / syslog-ng.conf
Created December 30, 2011 02:18
syslog-ng
@version: 3.0
# For a description of syslog-ng configuration file directives, please read
# the syslog-ng Administrator's guide at:
#
# http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/bk01-toc.html
#
# Source: https://wiki.archlinux.org/index.php/Syslog-ng
#
##########################################################
@clvrobj
clvrobj / l2tp.sh
Created January 21, 2012 12:58
l2tp.sh
#!/bin/bash
VPN_SERVICENAME="l2tpd"
VPN_PSK="fuckgfw"
VPN_IPRANGE="10.1.100"
VPN_USERNAME="fill in your username"
VPN_PASSWORD="your password"
#L2TPD/IPSEC
@guilleferrer
guilleferrer / Date Range Mongo Query
Created January 24, 2012 11:50
Query for a date range using Mongo Timestamps
db.Collection.find({
created_at : {
'$gte': new Timestamp(new Date(2012, 0, 21), 0),
'$lte': new Timestamp(new Date(2012, 0, 22), 0)
})
@fpletz
fpletz / flukso_get.py
Last active February 25, 2017 00:30
flukso -> sqlite
#!/usr/bin/python
from urllib2 import urlopen
import json
import pysqlite2.dbapi2 as dbapi
s = urlopen('http://localhost:8888/sensor/3bf0b9c10449b96ab972425045e36106').read()
data = json.loads(s)