Skip to content

Instantly share code, notes, and snippets.

View pixelbrackets's full-sized avatar
🧑‍🎓
Looking at other things right now

Dan Kleine (geb. Dan Untenzu) pixelbrackets

🧑‍🎓
Looking at other things right now
View GitHub Profile
@geraldvillorente
geraldvillorente / sitemap-crawler.php
Last active September 11, 2023 10:51
Sitemap crawler to test 301 and 404.
/**
* Crawl the sitemap.xml for 301 redirections and 404 errors.
* Source: http://edmondscommerce.github.io/php/crawl-an-xml-sitemap-quality-check-301-and-404.html
*
* To use this script you need to allocate a huge amount of time to maximum_execution_time to
* avoid Fatal error: Maximum execution time...I suggest to run this script on terminal.
* Ex: $ php test-xml.php > ~/Desktop/sitemap-curl-result.txt
*
* For 3000 links the average time the script consumed is around 45 minutes to 1 hour.
*/
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
@h4cc
h4cc / satis_install.sh
Last active February 13, 2024 16:39
Guide to install a satis server for composer. It can mirror packages and create a index for own packages.
# Install a Webserver
apt-get -y install apache2
# Target docroot to /home/satis/web/
# Install PHP5 CLI and needed programs.
apt-get -y install php5-cli php5-curl php5-json git wget
# Add a specifix user for our task
adduser satis
@pixelhandler
pixelhandler / pre-push.sh
Last active April 8, 2024 01:04
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@evertton
evertton / gfm2html.sh
Last active December 29, 2023 09:51
Convert a Github Flavored Markdown Syntax file to HTML
#!/bin/bash
# Convert a Github Flavored Markdown Syntax file to HTML
#
# The MIT License (MIT)
# Copyright © 2012 Evertton de Lima <e.everttonlima@gmail.com>
# http://evertton.mit-license.org/
# Stylesheet feature by Dan Untenzu <mail@pixelbrackets.de>
#
# Requirements: cURL (sudo apt-get install curl)
@benbalter
benbalter / parse-csv.php
Created July 24, 2012 22:28
Parse CSV into Associative Array
<?php
$lines = explode( "\n", file_get_contents( 'input.csv' ) );
$headers = str_getcsv( array_shift( $lines ) );
$data = array();
foreach ( $lines as $line ) {
$row = array();
foreach ( str_getcsv( $line ) as $key => $field )
@johanmeiring
johanmeiring / gist:2894568
Created June 8, 2012 08:52
PHP str_putcsv function
<?php
/* From: http://www.php.net/manual/en/function.str-getcsv.php#88773 and http://www.php.net/manual/en/function.str-getcsv.php#91170 */
if(!function_exists('str_putcsv'))
{
function str_putcsv($input, $delimiter = ',', $enclosure = '"')
{
// Open a memory "file" for read/write...
$fp = fopen('php://temp', 'r+');
// ... write the $input array to the "file" using fputcsv()...
fputcsv($fp, $input, $delimiter, $enclosure);
@jbroadway
jbroadway / Slimdown.md
Last active February 5, 2024 10:43
Slimdown - A simple regex-based Markdown parser.
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.