Skip to content

Instantly share code, notes, and snippets.

View DavidGarciaCat's full-sized avatar

David Garcia DavidGarciaCat

View GitHub Profile
@DavidGarciaCat
DavidGarciaCat / calendar.twig
Created July 26, 2017 21:38 — forked from aknosis/calendar.twig
Table based calendar only using Twig
{#
time can be any string acceptable by http://www.php.net/strtotime, the
template will output that time's month.
If you don't want to pass in a date you can set time like this:
{% set time = "now"|date("U") %}
{% set time = "December 2012"|date("U") %}
How ever you want to output items onto the calendar is a different issue,
but I'd assume pushing everything into an array numerically indexed by that day:
-- Database
SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME
FROM information_schema.SCHEMATA
WHERE schema_name = "database_name";
-- Tables
SELECT DISTINCT TABLE_COLLATION, COLLATION_NAME, CHARACTER_SET_NAME
FROM information_schema.`TABLES` AS t
INNER JOIN information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` AS ccsa ON ccsa.collation_name = t.table_collation
AND t.table_schema = "database_name";
{
"require": {
"mailgun/mailgun-php": "^2.4",
"php-http/curl-client": "^1.7",
"guzzlehttp/psr7": "^1.4"
}
}
@DavidGarciaCat
DavidGarciaCat / ffmpeg-install.sh
Last active February 26, 2018 23:00 — forked from clayton/ffmpeg-install.sh
Install FFMPEG on OS X with HomeBrew to convert Mp4 to WebM
# Installation
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
# Easy Peasy
ffmpeg -i video.mp4 video.webm
# FFMPEG convert video with multiple audio streams
# https://video.stackexchange.com/questions/12051/ffmpeg-convert-video-with-multiple-audio-streams
ffmpeg -i "The Bunker.avi" -map 0:0 -map 0:1 -map 0:2 -vcodec h264 -acodec:0 mp3 -acodec:1 mp3 TheBunkerNwMix.mp4
<?php
namespace AppBundle\Entity;
class User extends BaseUser
{
// properties, getters and setters
}
@DavidGarciaCat
DavidGarciaCat / nginx.conf
Created April 23, 2018 19:48 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
@DavidGarciaCat
DavidGarciaCat / curl.md
Created June 21, 2018 11:45 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

<?php
class County
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
@DavidGarciaCat
DavidGarciaCat / git-auto-sign-commits.sh
Created August 3, 2019 21:35 — forked from mort3za/git-auto-sign-commits.sh
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?