Skip to content

Instantly share code, notes, and snippets.

View damienalexandre's full-sized avatar
❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪

Damien Alexandre damienalexandre

❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪
View GitHub Profile
@hartfordfive
hartfordfive / reindex.sh
Last active May 19, 2023 12:32
Bash script to re-index all indices matching apattern from a remote Elasticsearch cluster to a local one
#!/bin/bash
if [ "$1" == "" ] || [ "$2" == "" ]; then
echo "Usage: ./reindex.sh [REMOTE_HOST:REMOTE_PORT] [INDEX_PATTERN] [LOCAL_HOST:LOCAL_PORT]"
exit 1
fi
REMOTE_HOST=$1
PATTERN=$2
if [ "$3" == "" ]; then
@wowo
wowo / pre-commit
Last active August 29, 2015 14:24
Basic pre-commit git hook
#!/bin/bash
exec < /dev/tty
phpunit
rc=$?
if [[ $rc != 0 ]] ; then
echo -n "It looks like some of your tests failed. "
exit $rc;
fi
@clintongormley
clintongormley / emoticon list
Created April 18, 2014 09:38
Emoticon analyzer
e_smiley :-) :) :o) :] :3 :c) :> =] 8) =) :} :^) :っ) :-)) :-))) :-)))) :)) :))) :))))
e_laugh :-D :D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D
e_sad >:[ :-( :( :-c :c :-< :っC :< :-[ :[ :{
e_wink_frown ;(
e_angry :-|| :@ >:(
e_cry :'-( :'(
e_happy_tears :'-) :')
e_disgust D:< D: D8 D; D= DX v.v D-':
e_surprise >:O :-O :O :-o :o 8-0 O_O o-o O_o o_O o_o O-O
e_kiss :* :^* '}{'
@pborreli
pborreli / YourCommand.php
Last active August 23, 2020 09:48
Show progress of a file download inside Symfony 2.3 console #howto
<?php
protected function execute(InputInterface $input, OutputInterface $output)
{
$progress = $this->getHelperSet()->get('progress');
$ctx = stream_context_create(array(), array('notification' => function ($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) use ($output, $progress) {
switch ($notification_code) {
case STREAM_NOTIFY_FILE_SIZE_IS:
$progress->start($output, $bytes_max);
break;
@n1k0
n1k0 / 404checker.js
Created January 11, 2013 10:55
A CasperJS script to check for 404 & 500 internal links on a given website
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@dadoonet
dadoonet / fr.sh
Created March 21, 2012 10:27
French analyzer for ES
#!/bin/bash
ES='http://localhost:9200'
ESIDX='test3'
ESTYPE='test'
curl -XDELETE $ES/$ESIDX
curl -XPUT $ES/$ESIDX/ -d '{
"settings" : {
@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.
@damienalexandre
damienalexandre / tool.php
Created October 3, 2011 09:47
Download large file from the web via php
<?php
/**
* Download a large distant file to a local destination.
*
* This method is very memory efficient :-)
* The file can be huge, PHP doesn't load it in memory.
*
* /!\ Warning, the return value is always true, you must use === to test the response type too.
*
* @author dalexandre