Skip to content

Instantly share code, notes, and snippets.

View topunix's full-sized avatar
🎯
Focusing

Mike ☕ topunix

🎯
Focusing
  • $HOME
View GitHub Profile
@phillipsharring
phillipsharring / Kernel.php
Last active October 9, 2023 13:11 — forked from kkiernan/MySqlDump.php
Laravel Artisan command to perform MySQL Dump using database connection information in the .env file. Posted 2016 Jan. Unsupported. Forked from https://gist.github.com/kkiernan/bdd0954d0149b89c372a
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
@jleeothon
jleeothon / lcs.py
Created October 5, 2014 15:02
Python: longest common subsequence (recursive)
def lcs(s, t):
if not s or not t:
return ''
if s[0] is t[0]:
return s[0] + lcs(s[1:], t[1:])
result1 = lcs(s[1:], t)
result2 = lcs(s, t[1:])
if len(result1) > len(result2):
return result1
else:
@Kartones
Kartones / postgres-cheatsheet.md
Last active April 19, 2024 13:15
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@ryansechrest
ryansechrest / php-style-guide.md
Last active April 16, 2024 07:38
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@joechrysler
joechrysler / who_is_my_mummy.sh
Last active April 8, 2024 13:36
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works: