Skip to content

Instantly share code, notes, and snippets.

View smalot's full-sized avatar

Sebastien MALOT smalot

View GitHub Profile
@marszall87
marszall87 / docker-compose-install.sh
Created September 25, 2015 13:14
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
#!/bin/bash
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@ajaxray
ajaxray / symfony2-bundle-config.md
Last active February 7, 2019 12:02
Symfony2 - Getting Bundle configuration from app/config/config.yml as a separated config block

APPROACH 1: Getting it as a parameter

With an extension (more on extensions here) you can keep this easily "separated" into different blocks in the config.yml and then inject that as a parameter gettable from the controller.

Inside your Extension class inside the DependencyInjection directory write this:

class MyNiceProjectExtension extends Extension
{
 public function load( array $configs, ContainerBuilder $container )
@chrismccoy
chrismccoy / gitcheats.txt
Last active February 27, 2025 15:51
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# aliases to change a git repo from private to public, and public to private using gh-cli
alias gitpublic="gh repo edit --accept-visibility-change-consequences --visibility public"
alias gitprivate="gh repo edit --accept-visibility-change-consequences --visibility private"
# delete all your repos using gh-cli (please do not run this unless you want to delete all your repos)
gh repo list --limit 300 --json url -q '.[].url' | xargs -n1 gh repo delete --yes
@FeroVolar
FeroVolar / redmine
Created December 11, 2013 14:32
Redmine init.d script for Debian
#!/bin/bash
### BEGIN INIT INFO
# Provides: redmine
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redmine webrick
# Description: redmine webrick server autostart-script
### END INIT INFO
@ptasker
ptasker / gist:7680134
Last active August 4, 2017 08:30
Swiftmailer create attachment
<?php
//Using composer to get the Sabre lib
require dirname ( __FILE__ ) . '/../vendor/autoload.php';
use Sabre\VObject\Component\VCalendar;
// Create a message
$message = Swift_Message::newInstance ( 'Message Title' )
->setFrom ( array( '[email protected] ' => 'John Doe' ) )
->setTo ( array( $email ) )
->setSubject ( "Cool message subject" )
@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet
@smalot
smalot / PdfParser.php
Last active January 6, 2025 20:04
Use this static class to extract Text from Pdf files. It supports compressed and uncompressed Pdf (version 1.1 to 1.7) : tested It supports octal encoded (eg : \050) content, but not hexadecimal (eg : <005E>). In some cases, it works better than "pdftotext" binary tool.
<?php
/**
* @file
* Class PdfParser
*
* @author : Sebastien MALOT <[email protected]>
* @date : 2013-08-08
*
* References :
@jpetazzo
jpetazzo / gist:6127116
Created July 31, 2013 23:21
Debian/Ubuntu containers protips, thanks to @spahl
# this forces dpkg not to call sync() after package extraction and speeds up install
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup
# we don't need and apt cache in a container
RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache
<?php
/**
* This script allows to redirect mail sent via the php mail function
* to a dedicated mailbox
*
* @date 2013-06-20
* @author Sébastien MALOT / Actualys
*
* ----------------------------------
@JosefJezek
JosefJezek / how-to-ntlm-with-apache.md
Last active July 27, 2021 02:42
How to NTLM with Apache