Skip to content

Instantly share code, notes, and snippets.

Lists sum problem

You are given two lists a and b with integers, that also can be negative, and a target sum.

Task:

  • find a function that returns true if two numbers in the list can be added to build the target sum.
@aoloe
aoloe / main.py
Created May 7, 2018 12:39
Python: Find the distance between points
#!/usr/bin/env python3
import math
from itertools import accumulate
from functools import reduce
points = [(1,2), (2,1), (5,3)]
# points = [[1,2], [2,1], [5,3]]
print(points)
@aoloe
aoloe / CMakeLists.txt
Last active March 21, 2018 15:42
cycle and reverse for scribus
CMAKE_MINIMUM_REQUIRED(VERSION 3.4)
PROJECT(cycle-and-reverse)
SET(CMAKE_CXX_STANDARD 14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
@aoloe
aoloe / CMakeLists.txt
Last active March 21, 2018 14:40
Refactoring AObjects
CMAKE_MINIMUM_REQUIRED(VERSION 3.4)
PROJECT(align-objects)
SET(CMAKE_CXX_STANDARD 14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
#!/usr/bin/python3
import os
import sys
import datetime
import argparse
import yaml
import json
import subprocess
import tempfile
<VirtualHost *:80>
# Indexes + Directory Root.
#DirectoryIndex index.html index.php
DocumentRoot /home/ale/docs/htdocs/graphicslab/htdocs/
<Directory /home/ale/docs/htdocs/graphicslab/htdocs/ >
# Options FollowSymLinks
# AllowOverride FileInfo Options
Options Indexes FollowSymLinks
AllowOverride AuthConfig FileInfo
@aoloe
aoloe / code_structure
Last active December 22, 2015 00:38
code structure
the scribus-core code is currently structured as foolows:
+ impagina-core/
- impagina-core.pro
- main.cpp
- scribus.cpp
- scribus.h
+ document/
- document.cpp
@aoloe
aoloe / composer.json
Created November 13, 2015 14:47
mustache with partials and associative arrays
{
"name": "aoloe/mustache-test",
"require" : {
"mustache/mustache" : "~2.5"
}
}
@aoloe
aoloe / WP-event-manager-notes.php
Created July 16, 2012 19:20 — forked from ms-studio/WP-event-manager-notes.php
Notes regarding the WP event manager
<?php
/*
Target:
*******
Perfect solution for a simple WP event manager
Needs:
******
@aoloe
aoloe / ex14_vector.cpp
Created September 22, 2015 20:32
exercise 19, chapter 4, programming c++
// type names and scores
#include "std_lib_facilities.h"
int main(){
vector<string> names;
vector<int> scores;
string name;
int score;