Skip to content

Instantly share code, notes, and snippets.

View dvapelnik's full-sized avatar

Dmitry Vapelnik dvapelnik

  • Ukraine, Vinnitsa
View GitHub Profile
<?php
class Text {
/**
* Limits a phrase to a given number of characters.
*
* $text = Text::limit_chars($text);
*
* @param string $str phrase to limit characters of
@fgm
fgm / Symfony2 GraphvizDumper demo
Last active November 18, 2017 17:14
Demonstrate how to use the GraphViz Dumper in a Symfony 2.4 project.
<?php
/**
* @file
* gvdump.php
*
* @author: Frédéric G. MARAND <fgm@osinet.fr>
*
* @copyright (c) 2014 Ouest Systèmes Informatiques (OSInet).
*
* @license MIT
@alexwybraniec
alexwybraniec / gist:2972487
Created June 22, 2012 12:32
Enabling Memcached graphing in Munin, Ubuntu 10.04 LTS, with munin-node already installed
sudo apt-get update
sudo apt-get install munin-plugins-extra
cd /etc/munin/plugins
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_bytes
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_counters
sudo ln -snf /usr/share/munin/plugins/memcached_ memcached_rates
sudo aptitude install libcache-memcached-perl
sudo /etc/init.d/munin-node restart
sudo tail -f /var/log/munin/munin-node.log
@colemanjp
colemanjp / gist:3952297
Created October 25, 2012 12:25
Check key length on dkim for our google apps domain

Check key length on dkim for our google apps domain

Get the public key for our selector

$ dig -t txt googleprd._domainkey.yale.edu

; <<>> DiG 9.9.1-P3-RedHat-9.9.1-9.P3.fc17 <<>> -t txt googleprd._domainkey.yale.edu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12280

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 5

#!/bin/sh
yum -y groupinstall "Development Tools"
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh epel-release-5*.rpm
rpm -Uvh remi-release-5*.rpm
yum -y install python-devel screen
yum --enablerepo=remi install libcurl-devel -y
mkdir /opt/miner
cd /opt/miner
@crofty
crofty / index.html
Last active October 22, 2021 08:24
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>
@jtilly
jtilly / install.sh
Last active September 2, 2023 00:15
Install qcachegrind on Ubuntu
#!/bin/bash
sudo apt-get install qt5-default
wget http://kcachegrind.sourceforge.net/kcachegrind-0.7.4.tar.gz
tar xvf kcachegrind-0.7.4.tar.gz
cd kcachegrind-0.7.4
qmake && make
sudo install -m 755 qcachegrind/qcachegrind /usr/local/bin
sudo install -m 644 qcachegrind/qcachegrind.desktop \
/usr/local/share/applications/
@huglester
huglester / roundcube_mail_disable_csrf_on_login.php
Last active October 12, 2023 07:31
RoundCube mail - disable CSRF protection on login example
<?php
/*
Install:
1) create a folder: disablecsrf inside 'plugins/' directory.
2) place this file there and name it: disablecsrf.php
3) go to config/config.inc.php, and add it to plugins, like:
$config['plugins'] = array('disablecsrf');
CSRF should now be disabled for login.
*/
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@loonies
loonies / 1_phpunit-api.md
Last active January 19, 2024 07:34
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()