Skip to content

Instantly share code, notes, and snippets.

View samir-plusb's full-sized avatar
🏠
Working from home

Samir Rachidi samir-plusb

🏠
Working from home
View GitHub Profile
@samir-plusb
samir-plusb / README.md
Created February 26, 2016 09:36 — forked from denji/README.md
Remove WebStorm; PhpStorm; PyCharm; RubyMine; AppCode; CLion, IntelliJ; 0xDBE10 settings and cli-links from Mac OSX

Quick uninstall JetBrains settings:

curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s
@samir-plusb
samir-plusb / index.html
Last active October 10, 2016 23:22 — forked from kylewelsby/index.html
postMessage Example
<html>
<head>
<script>
var count=0;
function sendMessage() {
window.parent.postMessage(
JSON.stringify({
url: 'http://heise.de',
plus: 21,
minus: 42,
@samir-plusb
samir-plusb / countries.json
Last active November 11, 2016 14:36 — forked from keeguon/countries.json
A list of countries in JSON
[
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
@samir-plusb
samir-plusb / php-5.3.22-fpm.sh
Last active March 16, 2017 00:28
php fpm init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-###PHP_VERSION###-###PHP_TYPE###
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-###PHP_VERSION###-###PHP_TYPE###
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
@samir-plusb
samir-plusb / README.md
Last active March 16, 2017 21:32 — forked from magnetikonline/README.md
Apache and Nginx & PHP-FPM systemd service config templates

Apache and Nginx & PHP-FPM systemd service config templates

A set of really basic systemd config templates for starting Nginx or Apache together with PHP-FPM on system boot. It can be used with sed to create systemd config files for multiple php-fpm instances:

  • Will ensure Nginx/Apache web server has started before kicking off PHP-FPM process.
  • PHP-FPM pid file placed in /run/php7
  • PHP7 PHP-FPM config at /etc/php7.
  • Based on usage with Centos 7 together with ISPConfig.

Both scripts placed in /lib/systemd/system and enabled by the following:

@samir-plusb
samir-plusb / svg-html-entities.js
Created September 8, 2017 09:25 — forked from timruffles/svg-html-entities.js
svg - supporting HTML entities, to avoid 'entity not defined' when you're exporting SVGs from the browser
// create a doctype that includes definitions for all HTML entities - http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
var doctype = '<?xml version="1.0" standalone="no"?>' +
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ '
+ HTML_ENTITIES() + ' ]>';
function HTML_ENTITIES() {
return '<!ENTITY quot "&#34;"> <!ENTITY amp "&#38;"> <!ENTITY apos "&#39;"> <!ENTITY lt "&#60;"> <!ENTITY gt "&#62;"> <!ENTITY nbsp "&#160;"> <!ENTITY iexcl "&#161;"> <!ENTITY cent "&#162;"> <!ENTITY pound "&#163;"> <!ENTITY curren "&#164;"> <!ENTITY yen "&#165;"> <!ENTITY brvbar "&#166;"> <!ENTITY sect "&#167;"> <!ENTITY uml "&#168;"> <!ENTITY copy "&#169;"> <!ENTITY ordf "&#170;"> <!ENTITY laquo "&#171;"> <!ENTITY not "&#172;"> <!ENTITY shy "&#173;"> <!ENTITY reg "&#174;"> <!ENTITY macr "&#175;"> <!ENTITY deg "&#176;"> <!ENTITY plusmn "&#177;"> <!ENTITY sup2 "&#178;"> <!ENTITY sup3 "&#179;"> <!ENTITY acute "&#180;"> <!ENT
@samir-plusb
samir-plusb / extabase_in_controller_action_validation_example.php
Created November 16, 2017 16:51 — forked from wolffc/extabase_in_controller_action_validation_example.php
This is an TYPO3 / Extbase Example on how to Validate some Properties in the Controller - this is usefull for conditonal Validation
<?php
class foo {
/**
* keep trac if we have created a custom error.
* @var boolean
*/
protected $hasCustomError = false;
@samir-plusb
samir-plusb / GIF-Screencast-OSX.md
Created March 8, 2018 16:56 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@samir-plusb
samir-plusb / wait_for_http_200.sh
Created April 10, 2018 17:29 — forked from rgl/wait_for_http_200.sh
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76

Bash scripts to wait for a service (must be one-liner)

Wait for service on port to answer

while ! nc -z httpd 80; do sleep 0.1; done

Wait for docker image httpd to be available