Skip to content

Instantly share code, notes, and snippets.

Avatar

Yevhenii Kurtov lessless

View GitHub Profile
@lessless
lessless / 01 Problem.md
Last active Dec 15, 2020
Two sums - bruteforce
View 01 Problem.md

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

Example 1:

View keybase.md

Keybase proof

I hereby claim:

  • I am lessless on github.
  • I am lessless (https://keybase.io/lessless) on keybase.
  • I have a public key ASDbUKvZIJvog5Mlht_iCeHuxEbx1u6lZmA_A-EEJbNyPQo

To claim this, I am signing this object:

@lessless
lessless / settings.json
Last active May 5, 2020
sublime config
View settings.json
{
"always_show_minimap_viewport": true,
"auto_find_in_selection": true,
"bold_folder_labels": true,
"caret_style": "wide",
"close_windows_when_empty": false,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow Night.sublime-color-scheme",
"copy_with_empty_selection": false,
"create_window_at_startup": false,
"detect_indentation": true,
View build.lib.sh
#!/bin/bash
# Name: build.lib.sh
# Author: Ladar Levison
#
# Description: Used to compile the external dependencies required by magma, and combine them into the magmad.so shared object file.
# Preliminary Dependency Matrix
# bzip2 -:-
View keybase.md

Keybase proof

I hereby claim:

  • I am lessless on github.
  • I am lessless (https://keybase.io/lessless) on keybase.
  • I have a public key ASC8pryUCClC3vPid1p7vrR3-R4oscimVjWnqJ5CjNTgAgo

To claim this, I am signing this object:

View Elm test assignment
Using elm-starter kit and GMaps JavaScript API create a program, which will display a map with a marker on the left
and marker coordinates on the right.
JavaScript is responsible for drawing map, listening to a marker position change and sending updated coordinates to the
Elm program. Elm program will just output updated coordinates on the page.
Possible visual appearance: http://www.awesomescreenshot.com/image/1303608/46dc61234e7baab90cb022ec7ccbd0b4
Things that will help you get started:
- Making Web functional https://www.youtube.com/watch?v=XJ9ckqCMiKk#t=28m40s (since 28m 40s)
- Elm starter kit https://github.com/splodingsocks/elm-starter
@lessless
lessless / elixir.sh
Created Jun 2, 2016
Codeship Elixir script
View elixir.sh
#!/bin/bash
# Totally c&p from various places all accross Internet
#
# Erlang
ERLANG_VERSION=${ERLANG_VERSION:-18.3}
ERLANG_CACHED_DOWNLOAD="${HOME}/cache/OTP-${ERLANG_VERSION}.tar.gz"
ERLANG_DIR=${ERLANG_DIR:="$HOME/erlang"}
# Elixir
View postgresql-fw.sh
#!/usr/bin/env bash
DB_MASTER=xxx
DB_BACKUP=yyy
# server
iptables -A INPUT -p tcp -s $DB_BACKUP --sport 1024:65535 -d $DB_MASTER --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s $DB_MASTER --sport 5432 -d $DB_BACKUP --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
#client
iptables -A OUTPUT -p tcp -s $DB_MASTER --sport 1024:65535 -d 0/0 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
reportFocus() {
console.log('focused');
}
}
});
View counter_cache.sql
CREATE FUNCTION maintain_realty_photos_count_trg() RETURNS TRIGGER AS
$$
BEGIN
IF TG_OP IN ('UPDATE', 'DELETE') THEN
UPDATE realties SET photos_count = photos_count - 1 WHERE id = old.realty_id;
RETURN old;
END IF;
IF TG_OP IN ('INSERT', 'UPDATE') THEN
UPDATE realties SET photos_count = photos_count + 1 WHERE id = new.realty_id;
RETURN new;