Skip to content

Instantly share code, notes, and snippets.

View cynovg's full-sized avatar

Novgorodcev Cyrill cynovg

  • VKontakte
  • Russia, St. Petersburg
View GitHub Profile
@cynovg
cynovg / texturesInScene2dgame.md
Created February 21, 2023 16:53 — forked from Leejjon/texturesInScene2dgame.md
How to organize your stages and textures in your libGDX game

Starting out

If you have started out to build a game with libGDX, you've were probably creating and disposing textures out like this:

public class MyGdxGame extends ApplicationAdapter {
    SpriteBatch batch;
    Texture badlogic;

    @Override

public void create () {

@cynovg
cynovg / bucket.pl
Created November 3, 2022 14:30
work w yandex object storage
#!/usr/bin/env perl
use utf8;
use v5.30;
use warnings;
use Const::Fast;
use URI;
use URI::QueryParam;
use HTTP::Request::Common;
use LWP;
use AWS::Signature4;
### Keybase proof
I hereby claim:
* I am cynovg on github.
* I am cynovg (https://keybase.io/cynovg) on keybase.
* I have a public key ASCjFPioIzcKrs21O-xh5h2wMtu9QQzp9pOv3Sv3pEmvvQo
To claim this, I am signing this object:
@cynovg
cynovg / migrate_repo.sh
Created October 30, 2019 10:29 — forked from mariozig/migrate_repo.sh
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror [email protected]:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@cynovg
cynovg / test.pl
Last active January 24, 2022 11:53
closure
#!/usr/bin/perl
use warnings;
use v5.16;
use Benchmark qw(:all);
timethese(
10000000,
{
cycle => sub {
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use v5.26.0;
use List::Util qw/first any/;
use Benchmark qw(:all);
use strict;
use warnings;
my $file = $ARGV[0] || die "USAGE: $0 filename";
my $processes = $ARGV[1] || 1;
my $block_size = 64 * 1024 * 1024;
my $fsize = -s $file or die 'no file';
my @offsets;
my @sizes;
# Setup an appropriate nginx log_format in the `http` section of your nginx config:
log_format main '$remote_addr $time_iso8601 "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_host" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_time ';
# Then save the following as a munin plugin to monitor the last 5 minutes of your nginx access.log file
@cynovg
cynovg / nginx_error_rate.py
Created July 19, 2018 13:59 — forked from eykd/nginx_error_rate.py
Munin plugin for displaying error rates from Nginx
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""nginx_error_rate -- Munin plugin to report the error rate in an access log.
The access log defaults to `/var/log/nginx/access.log`. This may be
customized with the following stanza in your munin plugin conf:
[nginx_error_rate]
env.access_log /path/to/access.log
"""
check process redis-server
with pidfile "/var/run/redis.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout