Skip to content

Instantly share code, notes, and snippets.

View denji's full-sized avatar
🇺🇦

Denis Denisov denji

🇺🇦
View GitHub Profile
@toddsiegel
toddsiegel / gist:9453514
Created March 9, 2014 19:52
Queries To Help with Tuning MySQL
-- Determine size of databases
-- Source: http://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database
SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;
-- Size in MB of the innodb_buffer_pool_size. Default is 128 MB.
-- More here: http://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_buffer_pool_size
SELECT @@innodb_buffer_pool_size / 1024 / 1024
@akitaonrails
akitaonrails / human_gc_stats.rb
Created April 9, 2014 00:17
Just a hack to make it easier to understand GC.stat in Ruby 2.0 and 2.1 (made for a tech talk)
# This is an attempt to translate GC.stat to a more understandable format for humans
# from @samsaffron
# http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc?utm_source=rubyweekly&utm_medium=email
# http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
def gc_stats
stats = GC.stat
space_count = ObjectSpace.count_objects
objects_per_heap = space_count[:TOTAL] / stats[:heap_used]
report = {
@numberoverzero
numberoverzero / worker-transferrable.html
Created April 29, 2014 01:18
WebWorker showing off transferrables
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
</head>
<body>
<div>Transferring an array</div>
<button id='bPopulate' onclick='populateArray()'>Populate Array</button>
<button id='bSend' onclick='sendArray()'>Send Array</button>
<div id='output'></div>
@lutangar
lutangar / Chmod.php
Last active August 29, 2015 14:00
Magallanese more flexible permissions/chmod task
<?php
namespace Task;
use Mage\Task\AbstractTask;
class Chmod extends AbstractTask
{
public function getName()
{
@cypres
cypres / .astylerc
Created June 11, 2014 08:16
OC C++ config for astyle plugin
# astylerc
align-pointer=name
align-reference=name
max-code-length=120
break-after-logical
indent=spaces=2
style=google
# Padding
pad-header

YouTube 1080p Downloader

The Problem

It used to be you could directly download any YouTube video in any quality you wanted, as a single .mp4 file. However, around a year ago, YouTube switched from the "single file stream", to "DASH" streaming, which streams the video and the audio to you as two separate streams, which are played in sync with each other in the YouTube player.

It's still possible to download YouTube videos as a single file, but YouTube only offers that for qualities up to 720p. So you can't download "single file stream" videos in 1080p or higher.

@arunk-s
arunk-s / nginx.toml
Created July 9, 2014 16:13
Hekad configuration file for anamoly detection from nginx logs
[hekad]
maxprocs = 4
# Nginx access log reader
[Nginxserver]
type = "LogstreamerInput"
log_directory = "/var/log/nginx"
file_match = 'access\.log'
decoder = "CombinedNginxDecoder"
SELECT CONCAT(FORMAT(DataPages*100.0/TotalPages,2),' %') BufferPoolDataPercentage FROM
(SELECT variable_value DataPages FROM information_schema.global_status
WHERE variable_name = 'Innodb_buffer_pool_pages_data') A,
(SELECT variable_value TotalPages FROM information_schema.global_status
WHERE variable_name = 'Innodb_buffer_pool_pages_total') B;
@paulocheque
paulocheque / network.sh
Last active August 29, 2015 14:06
network commands
Network
================================
ping ip/dns
telnet ip/dns:port
netstat
http
iptables
sudo lsof -i :5955 # check which process is using port 5955
@SteveBenner
SteveBenner / regexes.md
Last active August 29, 2015 14:09
Useful Regular Expressions I’ve come up with

Regular Expressions

Text coloring / highlighting

I use the following regexes with [iTerm2][iterm]'s ['trigger' feature][it1] to create some basic syntax highlighting.

(?<=- )([A-Z][A-Z ]+:)+ Colorize CONSTANTS Magenta
(?<=- )(:|")\w*"?(?= =>) Colorize :keys => / "keys" => Yellow
^([^=]*)(?==) Colorize ENV_VARS Cyan
(?&lt;=[^=])= Colorize the = separator Dark Grey