Skip to content

Instantly share code, notes, and snippets.

View alopatindev's full-sized avatar

Alexander Lopatin alopatindev

View GitHub Profile

Keybase proof

I hereby claim:

  • I am alopatindev on github.
  • I am alopatindev (https://keybase.io/alopatindev) on keybase.
  • I have a public key whose fingerprint is 1C98 5509 A5F0 7B4D 4DF3 8BCA 44FB 438E DA18 3EF0

To claim this, I am signing this object:

#!/usr/bin/env python2
# https://www.youtube.com/watch?v=YEBfamv-_do
from random import randrange
public_prime = 67280421310721 # aka p
public_base = 3 # aka g
def generate_key():
#!/usr/bin/env python2
# https://www.youtube.com/watch?v=tIpKfDc295M
# https://www.youtube.com/watch?v=umAeJ7LMCfU
import numpy as np
f = lambda x, y: x * x + 2.0 * y
d_dx = lambda x, y: 2.0 * x
d_dy = lambda x, y: 2.0
@alopatindev
alopatindev / Kmeans.scala
Last active May 7, 2017 22:33
K-means clustering algorithm
// https://www.youtube.com/watch?v=_aWzGGNrcic
// https://www.youtube.com/watch?v=RD0nNK51Fp8
import scala.io.Source
import scala.util.Random
import java.io.{BufferedWriter, FileWriter}
object Kmeans extends App {
case class Point(val x: Double, val y: Double) {
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
let val = 'global 1'
this.val = 'global 2'
console.log('val = ' + val)
class Foo {
constructor() {
this.val = 'property'
}
}
@alopatindev
alopatindev / JobsSelector.scala
Last active December 25, 2016 21:24
Domain selection tool based on interest in technologies the domain relates to
// Developed by Alexander Lopatin (https://alopatindev.github.io)
// See https://alopatindev.github.io/2016/04/30/career-shift-time/
// This program is licensed under the terms of WTFPL
object JobsSelector extends App {
import scala.language.postfixOps
import scala.util.Try
val backendTechs: Set[String] = Set("nodejs", "Scala", "C++", "C", "MySQL", "PostgreSQL", "MongoDB", "Redis", "OrientDB", "Databases", "Play Framework", "JavaScript", "GNU/Linux", "Free Software", "Java", "nginx", "Network Stack", "JVM")
@alopatindev
alopatindev / .gdbinit
Last active October 12, 2016 20:32
~/.gdbinit enables colors; requires colout
set height 0
set pagination off
set disassembly-flavor intel
# Don't wrap line or the coloring regexp won't work.
set width 0
# Create a named pipe to get outputs from gdb
shell test -e /tmp/coloutPipe && rm /tmp/coloutPipe
shell mkfifo /tmp/coloutPipe
warning: file found to be present in multiple build targets: /tmp/quickcheck/quickcheck_macros/examples/attribute.rswarning: file found to be present in multiple build targets: /tmp/quickcheck/quickcheck_macros/examples/attribute.rs
Updating registry `https://github.com/rust-lang/crates.io-index`
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling regex-syntax v0.3.4
Compiling regex-syntax v0.3.4
Compiling winapi Compiling winapi v0.2.8 v0.2.8
Compiling Compiling log v0.log v0.3.3.6
6
@alopatindev
alopatindev / TextView.html
Last active July 3, 2016 14:34
QDeviceMonitor: possible solution for memory leak and performance issues
<!DOCTYPE html>
<html>
<head>
<script>
var colors = {};
var elementsPerLine = 8;
function createSpanElement (color, text) {
var element = document.createElement('span');
element.setAttribute('style', 'color:' + color);