Skip to content

Instantly share code, notes, and snippets.

View maximveksler's full-sized avatar
Wow

Maxim Veksler maximveksler

Wow
  • Tel Aviv, Israel
  • 13:03 (UTC +03:00)
  • X @mvxlr
View GitHub Profile
@maximveksler
maximveksler / main.swift
Last active January 24, 2017 21:48
Using #ifdef Xcode to detect debug builds in Swift
func _hackon_FacebookGET(_ stdin: FileHandle) -> Data {
#if Xcode
return "{\"httpMethod\":\"GET\", \"queryStringParameters\":{\"hub.mode\":\"subscribe\",\"hub.challenge\":\"56922036\",\"hub.verify_token\":\"Swift time is the best time\"},\"body\":null,\"isBase64Encoded\":false}".data(using: .utf8)!
#else
return stdin.readDataToEndOfFile()
#endif
}
let input = try Jay().jsonFromData(_hackon_FacebookGET(FileHandle.standardInput))
@maximveksler
maximveksler / LoggerAPI.swift
Created February 5, 2017 05:17
Benchmark extension for IBM Swift HeliumLogger
//
// LoggerAPI.swift
// Collection
//
// Created by Maxim Veksler on 05/02/2017.
//
//
import Foundation
import LoggerAPI
@maximveksler
maximveksler / Map.swift
Last active February 14, 2017 00:53
Functional Swift - Examples used in https://gumroad.com/l/natural-swift
import Foundation
func lengthOf(strings: [String]) -> [Int] {
return strings.map { $0.characters.count }
}
let fruits = ["Apple", "Cheery", "Orange", "Pineapple"]
let upperFruits = fruits.map { $0.uppercased() }
let scores = [100, 80, 85]
@maximveksler
maximveksler / TapeACall_downloader.rb
Last active June 2, 2017 14:52
TapeACall recordings download script
require 'csv'
require 'date'
require 'net/http'
all = CSV.read("TapeACall Recordings.csv")[1 .. -1]
all.each do |x|
csv_date = x[0]
csv_label = x[1]
csv_duration = x[2]
csv_link = x[3]
A great way to assess how your life is going and where you might be able to improve it to have a more balanced and healthy life is to try to be successful in these 6 areas of life:
1) Intimate Relationships
2) Friendships
3) Family
4) Career and Education (livelihood)
5) Time Away from Work (creativity)
6) Drugs/Alcohol (health)
Now you can assess your success in these 6 categories, which is the first step to setting a plan to improve each of them. I've also specified the last 3 categories to fit into another way to view life, which is to ensure you have one aspect that that provides your livelihood (a job), one aspect that allows for a creative outlet (music, painting, writing, etc) because all humans essentially yearn to create something, and one aspect that allows for exercise/health and reduce your drugs and alcohol intake.
1) If you do not have any intimate relationships, you must consider how to improve on this aspect. This might include things like dating sites, going to bars, Tinder, etc. However, my
@maximveksler
maximveksler / big query merge.sql
Created July 12, 2018 20:08
Big Query Table Merge
# Google BigQuery - Merge data
bigquery_merge() {
echo "Loading ${GC_BQ_WORK_TABLE} table into ${GC_BQ_MERGE}"
bq --location=US load --source_format=NEWLINE_DELIMITED_JSON --encoding=UTF-8 \
"${GC_BQ_MERGE}.${GC_BQ_WORK_TABLE}" "${TRANSFORM_STORE}/${filename}" \
schemas/${GC_BQ_TABLE}.json.schema
echo "Merging into ${GC_BQ_DATASET}.${GC_BQ_TABLE}"
cat <<bigtable-merge | bq --location=US query --use_legacy_sql=false --max_rows=0
MERGE \`${GC_BQ_DATASET}.${GC_BQ_TABLE}\` T
  • iqvoc - SKOS(-XL) Vocabulary Management System for the Semantic Web.
@maximveksler
maximveksler / all the ways to create spark dataframe.py
Last active October 21, 2020 20:42
All the ways to create a Spark Dataframe (pyspark)
data = [
("a", "Alice", 34),
("b", "Bob", 36),
("c", "Charlie", 30),
]
df = spark.createDataFrame(data, schema=["id", "name", "age"])
C:\Users\user\code>pip install rpaframework
Collecting rpaframework
Downloading rpaframework-9.4.0-py3-none-any.whl (214 kB)
|████████████████████████████████| 214 kB 595 kB/s
Collecting robotframework-sapguilibrary<2.0,>=1.1; sys_platform == "win32"
Downloading robotframework-sapguilibrary-1.1.tar.gz (9.5 kB)
Collecting robotframework-seleniumlibrary<6.0.0,>=5.1.0
Downloading robotframework_seleniumlibrary-5.1.3-py2.py3-none-any.whl (94 kB)
|████████████████████████████████| 94 kB 3.3 MB/s
Collecting pywinauto<0.7.0,>=0.6.8; python_version < "3.7.6" and sys_platform == "win32" or python_version > "3.7.6" and python_version < "3.8.1" and sys_platform == "win32" or python_version > "3.8.1" and sys_platform == "win32"
<graphml xmlns='http://graphml.graphdrawing.org/xmlns'>
<key id='type' for='node' attr.name='type' attr.type='string'></key>
<key id='code' for='node' attr.name='code' attr.type='string'></key>
<key id='icao' for='node' attr.name='icao' attr.type='string'></key>
<key id='desc' for='node' attr.name='desc' attr.type='string'></key>
<key id='region' for='node' attr.name='region' attr.type='string'></key>
<key id='runways' for='node' attr.name='runways' attr.type='int'></key>
<key id='longest' for='node' attr.name='longest' attr.type='int'></key>
<key id='elev' for='node' attr.name='elev' attr.type='int'></key>
<key id='country' for='node' attr.name='country' attr.type='string'></key>