Skip to content

Instantly share code, notes, and snippets.

View dlucian's full-sized avatar
💭
🦇

Lucian Daniliuc dlucian

💭
🦇
View GitHub Profile

Searching

Search files with a certain extension for a specific string

find . -name "*.php" -exec grep -H "217.156.XXX.XXX" {} \;

Search files older than X days and delete them

find /var/log/.../*.log -mtime +3 -exec rm {} \;

Searching in files over several lines

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>HTML5 Quicktest Form!</title>
<!--<link rel="stylesheet" href="css/main.css" type="text/css" />-->
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<!--[if lte IE 7]>
<?
// This code works with an optional $country_code variable that preselects a country
$countries = array(
'AF'=>'Afghanistan',
'AL'=>'Albania',
'DZ'=>'Algeria',
'AS'=>'American Samoa',
'AD'=>'Andorra',
'AO'=>'Angola',
'AI'=>'Anguilla',
@dlucian
dlucian / Timezone-Select-Template.html
Created June 10, 2013 20:32
Timezone generated HTML output by the Timezone PHP Generator: https://github.com/dlucian/Timezone-Generator-PHP
<select name="timezone" id="timezone">
<optgroup label="UTC -11:00">
<option value="Pacific/Midway">UTC -11:00 Midway</option>
<option value="Pacific/Niue">UTC -11:00 Niue</option>
<option value="Pacific/Pago_Pago">UTC -11:00 Pago_Pago</option>
</optgroup>
<optgroup label="UTC -10:00">
<option value="America/Adak">UTC -10:00 Adak</option>
<option value="Pacific/Honolulu">UTC -10:00 Honolulu</option>
<option value="Pacific/Johnston">UTC -10:00 Johnston</option>