Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjaminhu

  • Liftkeeper
  • Budapest, Hungary
View GitHub Profile
@fandaa
fandaa / utils.sql
Last active Jan 30, 2021
PostgreSQL utils
View utils.sql
-- v5
----------------------------------------------------------- basic instance info
-- show db version
SELECT version();
-- uptime
SELECT pg_postmaster_start_time();
-- show connections
@estysdesu
estysdesu / create_constraint_if_not_exists.sql
Last active Feb 12, 2021
[PostgreSQL: create constraint if not exists] not sure of sql compatibility with other engines #postgres #constraint #sql
View create_constraint_if_not_exists.sql
// vim: syntax=sql
CREATE OR REPLACE FUNCTION create_constraint_if_not_exists (t_name text, c_name text, constraint_sql text)
RETURNS void
AS
$BODY$
BEGIN
-- Look for our constraint
IF NOT EXISTS (SELECT constraint_name
FROM information_schema.constraint_column_usage
@Werninator
Werninator / php_detect_eol.php
Last active Oct 3, 2020
[php] detect EOL type from string
View php_detect_eol.php
<?php
/**
* Detects the end-of-line character of a string.
* modified version from https://stackoverflow.com/questions/11066857/detect-eol-type-using-php
* @param string $str The string to check.
* @param string $default Default EOL (if not detected).
* @return string The detected EOL, or default one.
*/
function detectEol($str, $default = PHP_EOL) {
@mohammedyunus009
mohammedyunus009 / pdf2htmlEX.sh
Last active Nov 27, 2020 — forked from rajeevkannav/pdf2htmlEX.sh
Install CMake, pkg-config,GNU Getopt,GCC,poppler,fontforge,pdf2htmlEX in Ubuntu 16.05
View pdf2htmlEX.sh
#!/bin/bash
# Ubuntu Developer Script For pdf2htmlEx
# Created by Rajeev Kannav Sharma
# http://rajeevkannav.github.io/
#
#
# Downloads and configures the following:
#
# CMake, pkg-config
# GNU Getopt
@quonic
quonic / scum_sqlite.ps1
Last active Nov 15, 2020
For the game SCUM. This sets stats too 5 and skills to 4 for specified character.
View scum_sqlite.ps1
#Requires -Module PSSQLite
param(
[Alias('Name', '')]
[string]
$ProfileName
)
<#
Updated for 9/2 patch
Updated by request of Truth91
#>
@spagu
spagu / pre-commit
Last active Nov 19, 2020
subversion pre-commit hook for PHP lint, PSR-2 and CSS validation + comments
View pre-commit
#!/bin/sh
# SVN PRE-COMMIT HOOK
#
# Requirements:
# - PHP installed ( https://secure.php.net/manual/en/install.php )
# - PHPCS installed ( https://github.com/squizlabs/PHP_CodeSniffer + https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards )
# - csslint installed ( https://github.com/CSSLint/csslint/wiki/command-line-interface )
# - i18n0lint installed ( https://github.com/jwarby/i18n-lint )
View template.yml
Parameters:
InstanceImageIdParameter:
Type: AWS::EC2::Image::Id
Default: 'ami-5055cd3f'
InstanceTypeParameter:
Type: String
Default: t2.micro
InstanceKeyNameParameter:
Type: String
InstanceNameParameter:
@anvk
anvk / psql_useful_stat_queries.sql
Last active Mar 3, 2021
List of some useful Stat Queries for PSQL
View psql_useful_stat_queries.sql
--- 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
View analyze_nginx_access_logs.sh
#!/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 Mar 3, 2021
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)
View README.md

Parameters

Container: MP4

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

Video codec: H.264