Skip to content

Instantly share code, notes, and snippets.

@R11baka
R11baka / gist:0e5d1efaccdec805d0b1c3dd1250d1bb
Created December 30, 2024 10:31
AWS Logs Insights and Slow query log parse
fields @timestamp
| parse @message /Query_time:\s*(?<Query_time>[0-9]+(?:\.[0-9]+)?)\s*Lock_time:\s*(?<Lock_time>[0-9]+(?:\.[0-9]+)?)\s*Rows_sent:\s*(?<Rows_sent>[0-9]+)\s*Rows_examined:\s*(?<Rows_examined>[0-9]+)[\s\S]*?;/
| parse @message /SET timestamp=\d+;\n(?<Query>[^;]*)/
| sort Query_time desc
| limit 100
@R11baka
R11baka / main.go
Created October 27, 2021 17:56
Цепочка единиц
package main
import "fmt"
func maxOnesAfterRemoveItem(list []byte) uint {
oneLength := uint(0)
maxLen := uint(0)
skipFirst0 := true
skippedPrevZeroIndex := 0
for i := 0; i < len(list); i++ {
class AccountRepository
{
const CHUNK_SIZE = 200;
public static function getUpdatedAccounts($days, $limit = 10, $lastId = null)
{
$query = Account::lastUpdated($days);
if (!empty($lastId)) {
$query->where('SocialAccountId', '>', $lastId);
#!/usr/bin/perl
use Socket;
$ARGC=@ARGV;
my ($ip,$port,$size,$time);
$ip=$ARGV[0];
$port=$ARGV[0];
$time=$ARGV[0];
socket(crazy, PF_INET, SOCK_DGRAM, 17);
$iaddr = inet_aton("$ip");
@R11baka
R11baka / Install nodejs on CentOs
Created January 25, 2016 14:47
Install nodejs on CentOs
$ wget https://raw.github.com/isaacs/nave/master/nave.sh
$ chmod +x nave.sh
$ ./nave.sh install 5.1.0
$ ./nave.sh use 5.1.0
$ node -v
@R11baka
R11baka / css_resources.md
Last active August 29, 2015 14:16 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@R11baka
R11baka / javascript_resources.md
Last active August 29, 2015 14:16 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@R11baka
R11baka / DeployVersion.php
Created August 29, 2014 14:13
Symfony2 buildnumber in footer
use JMS\DiExtraBundle\Annotation\Inject;
use JMS\DiExtraBundle\Annotation\InjectParams;
use JMS\DiExtraBundle\Annotation\Service;
use JMS\DiExtraBundle\Annotation\Tag;
use Twig_Extension;
/**
* @Service()
* @Tag("twig.extension")
$email = new SendGrid\Email();
$email->setFrom(APP_FEEDBACK_EMAIL)
->setSubject('TEST EMAIL FROM STANDALONE BDAYCARDS')
->addFilter('subscriptiontrack', "enable", 1)
->addFilter(
'subscriptiontrack',
"text/html",
"If you would like to unsubscribe and stop receiving these emails <% click here %>."
)
->addFilter('subscriptiontrack','replace','[unsubscribe_link]');
@R11baka
R11baka / uglify.pp
Created July 10, 2014 09:12
Install uglifyCss and uglifyJs by puppet on CentOs
# instal minify
package { 'uglify-js':
ensure => installed,
}
# install nodejs package manager
package{ "npm":
ensure => installed
}