Skip to content

Instantly share code, notes, and snippets.

View abilogos's full-sized avatar
🏠
Working from home

ǃшɒʞɒH ǃǀɄ abilogos

🏠
Working from home
View GitHub Profile
@mrbar42
mrbar42 / README.md
Last active March 28, 2024 18:06
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
@chronon
chronon / ext.txt
Created February 18, 2017 15:38
List of docker-php-ext-install extension names
Possible values for ext-name:
bcmath
bz2
calendar
ctype
curl
dba
dom
enchant
@cagartner
cagartner / Controller.php
Created January 16, 2017 11:05
Get Raw Sql in Yii2
<?php
$query = Model::findAll();
var_dump($query->createCommand()->rawSql); exit;
function toRad(degree) { return degree * Math.PI / 180; }
function toDeg(radian) { return radian * 180 / Math.PI; }
// round floating point errors
function rnd( float ){
return (Math.floor(100000 * float) / 100000).toFixed(5);
}
function assert( a, b ){
@ben-albon
ben-albon / php5.6-pgsql.Dockerfile
Last active February 28, 2024 09:00
Docker PHP Image with PostgreSQL Driver
FROM php:5.6-apache
RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql
COPY src/ /var/www/html

How do I do this thing?

I'm not aware of how to use Google, how do I do this basic thing in Language X?

tagged coding, question

edited by Grammar Nazi (2.5M), asked by 1337z0r (2)

Answer 1 (12)

@pastuhov
pastuhov / MasterTrait.php
Last active August 14, 2023 09:16
Use Master yii2 activerecord trait
<?php
namespace common\models;
trait MasterTrait
{
public static function getDb()
{
$connection = clone \Yii::$app->getDb();
$connection->enableSlaves = false;
return $connection;
@scaryguy
scaryguy / change_primary_key.md
Last active April 8, 2024 14:23
How to change PRIMARY KEY of an existing PostgreSQL table?
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of  your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
@jtdp
jtdp / gist:5443498
Last active January 24, 2024 08:59
Revert file permission changes in local git repository.. Very useful when you change permissions due to working on a samba share. Lifted from: http://stackoverflow.com/questions/2517339/git-how-to-recover-the-file-permissions-git-thinks-the-file-should-be
git diff -p \
| grep -E '^(diff|old mode|new mode)' \
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
| git apply
@tuupola
tuupola / isikukood.js
Created September 3, 2009 14:13
Validate Estonian national identification number (isikukood).
/*
* Validate Estonian national identification code.
*
* Copyright (c) 2009 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*/
function isikukood(kood) {