Skip to content

Instantly share code, notes, and snippets.

I'm not a great programmer; I'm just a good programmer with great habits.

Alexey Vasiliev le0pard

I'm not a great programmer; I'm just a good programmer with great habits.
Block or report user

Report or block le0pard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
le0pard / app.jsx
Created Oct 9, 2016
React and Flux example for screencast
View app.jsx
import React from 'react'
import {Dispatcher} from 'flux'
import {EventEmitter} from 'events'
import keyMirror from 'fbjs/lib/keyMirror'
import './app.sass'
const actions = keyMirror({
le0pard /
Last active Nov 18, 2015
Tribit алгоритм

Для обработки малых пирамид при применении системы правил и усечении, генерируются индексы соответствующие каждой пирамиде. Эти индексы соответствуют номерам символов входной строки, которые соответствуют пирамиде.

Например: во входной строке символы нумеруются

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

в пирамиде соответствующие индексы будут соответствовать ячейкам

le0pard / test.rb
Created Sep 22, 2015
pop3 by ruby from mailtrap
View test.rb
2.2.0 :014 > s.puts "LIST\r"
=> nil
2.2.0 :015 > s.gets
=> "+OK 50 messages (4192565 octets)\r\n"
2.2.0 :016 > s.gets
=> "1 14181\r\n"
2.2.0 :017 > s.gets
=> "2 127\r\n"
2.2.0 :018 > s.gets
=> "3 127\r\n"
telnet ruby-2.2.0
telnet> toggle crlf
Will send carriage returns as telnet <CR><LF>.
telnet> open 1100
Connected to
Escape character is '^]'.
+OK POP3 ready <>
USER ***
View pop3.rb
require 'net/pop'
raise "args shoud be email ans pass" if ARGV.length < 2
username, password = ARGV[0], ARGV[1]
Net::POP3.start('', 1100, username, password, true) do |pop|
if pop.mails.empty?
puts 'No mail.'
pop.each_mail do |m|
le0pard / lovefield_test.patch
Created May 12, 2015
lovefield + browserify
View lovefield_test.patch
diff --git samples/calculator/calculator.html samples/calculator/calculator.html
index 7f80d0c..acfd40b 100644
--- samples/calculator/calculator.html
+++ samples/calculator/calculator.html
@@ -2,11 +2,7 @@
<link rel="stylesheet" type="text/css" href="style.css" />
- <script src="jquery/jquery.min.js"></script>
- <script src="lovefield.js"></script>
le0pard / test.ex
Created Jun 26, 2014
Elixir 0.4.1 error
View test.ex
case worker_record do
record = WorkerRecord[at: at, at_queue: at_queue] when is_number(at) and at > timestamp and is_bitstring(at_queue) ->
# do something
_ ->
# do something
## I get error:
## cannot invoke remote function Access.get/2 inside match
le0pard / pg_bloat.sql
Last active Aug 29, 2015
PG table and indexes bloat
View pg_bloat.sql
WITH constants AS (
SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 4 AS ma
), bloat_info AS (
(datawidth+(hdr+ma-(case when hdr%ma=0 THEN ma ELSE hdr%ma END)))::numeric AS datahdr,
(maxfracsum*(nullhdr+ma-(case when nullhdr%ma=0 THEN ma ELSE nullhdr%ma END))) AS nullhdr2
schemaname, tablename, hdr, ma, bs,
le0pard / scout_simple_check_ssl.rb
Last active Dec 16, 2015
This scout plugin give info about ssl cert, which installed on web server. You can create trigger, which will notify before ssl cert expired.
View scout_simple_check_ssl.rb
require 'net/https'
require 'uri'
class SimpleSslCheckPlugin < Scout::Plugin
default: https://localhost
def build_report
View Ember nice to know
# ROUTER (match) ->
#match("/").to("home") # home.handlebars gets rendered automatically and mapped to /
# according to guide the previous logic shouldn't be needed. but it won't work without it
# you can either use model: () -> or
# setupController: (controller, model) ->
# controller.set 'content', model
You can’t perform that action at this time.