Skip to content

Instantly share code, notes, and snippets.

View Benjaminhu's full-sized avatar
🚀
To infinity and beyond.

Simon Benjámin Benjaminhu

🚀
To infinity and beyond.
View GitHub Profile
@Yousha
Yousha / .gitattributes
Last active March 8, 2023 11:17
.gitattributes for PHP developers.
* text=auto
###### Git
.gitattributes text
.gitignore text
.gitconfig text
.gitmodules text
##### Windows
*.bat text eol=crlf
@anvk
anvk / psql_useful_stat_queries.sql
Last active April 23, 2024 03:15
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@vinsim24
vinsim24 / findExamples.sh
Created September 23, 2017 18:50
Bash Find Examples
#!/bin/bash
#Find all link files
ls -ltr `find . -maxdepth 1 -type l -print`
#Find and remove all files whose modified time is greater than 30 days
find . -type f -mtime +30 -exec rm {} \;
#Find particular word across files in same directory
find . -type f | xargs grep -l "searched_word"
#!/bin/bash
# variables
LOGFILE="/var/log/nginx/access.log"
LOGFILE_GZ="/var/log/nginx/access.log.*"
RESPONSE_CODE="200"
# functions
filters(){
grep $RESPONSE_CODE \
@mikoim
mikoim / README.md
Last active April 27, 2024 00:22
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@SimonEast
SimonEast / Acceptance.php
Last active March 11, 2021 15:07
Codeception - how to test for redirects
<?php
// Simply place the following two functions in _support/Helper/Acceptance.php
// Then you can call $I->verifyRedirect(...) inside your tests
namespace Helper;
class Acceptance extends \Codeception\Module
{
/**
* Ensure that a particular URL does NOT contain a 301/302
@agarzon
agarzon / install-php-tools.sh
Last active October 27, 2021 03:48
Install globally popular PHP dev tools like composer, phpunit, phpcs, phpmd, phpcpd, deployer, robo, codeception, etc.
#!/bin/bash
#To execute it directly: sudo bash <(curl -s https://gist.githubusercontent.com/agarzon/ecb0b92d4c8e1bbde126534c76721a58/raw/install-php-tools.sh)
BIN_PATH=/usr/local/bin/
#COMPOSER
sudo curl -LsS https://getcomposer.org/composer.phar -o ${BIN_PATH}composer
sudo chmod a+x ${BIN_PATH}composer
@m4munib
m4munib / php_command_pattern.php
Created May 29, 2016 16:16
Abstract Class - PHP Command
<?php
interface InterfaceCommand {
function execute();
}
abstract class AbstractCommand implements InterfaceCommand {
/**
@dpalomar
dpalomar / .gitattributes
Created April 8, 2016 12:43
Fixing CRLF with gitattributes
From this [issue](https://github.com/puphpet/puphpet/issues/1025#issuecomment-157059174):
I know that this issue is closed, but as I spent a lot of time to understand what was going on, I made some researches and I can explain why this happen, and you can fix it.
Using git config core.autocrlf true can help, but not on a multi-developpers project.
This command has to be the same on each developper machine, and that's not always the case.
You have to use the .gitattributes provided in the puphpet archive and edit it as follow (carefull, this file need to be in your project root)
You also need to use an IDE that allow you to save/edit files as LF (like phpstorm). You can check the type of the file in the bottom right corner, in the status bar (you'll see LF or CRLF while a file is opened)
@Chandler
Chandler / slack_history.py
Last active March 26, 2024 14:35
Download Slack Channel/PrivateChannel/DirectMessage History
print("UPDATE AUG 2023: this script is beyond old and broken")
print("You may find interesting and more up to date resources in the comments of the gist")
exit()
from slacker import Slacker
import json
import argparse
import os
# This script finds all channels, private channels and direct messages