As configured in my dotfiles.
start new:
tmux
start new with session name:
# Usage: | |
# source iterm2.zsh | |
# iTerm2 tab color commands | |
# https://iterm2.com/documentation-escape-codes.html | |
if [[ -n "$ITERM_SESSION_ID" ]]; then | |
tab-color() { | |
echo -ne "\033]6;1;bg;red;brightness;$1\a" | |
echo -ne "\033]6;1;bg;green;brightness;$2\a" |
As configured in my dotfiles.
start new:
tmux
start new with session name:
CREATE OR REPLACE FUNCTION upsert_tableName(arg1 type, arg2 type) RETURNS VOID AS $$ | |
DECLARE | |
BEGIN | |
UPDATE tableName SET col1 = value WHERE colX = arg1 and colY = arg2; | |
IF NOT FOUND THEN | |
INSERT INTO tableName values (value, arg1, arg2); | |
END IF; | |
END; | |
$$ LANGUAGE 'plpgsql'; |
# -*- coding: utf-8 -*- | |
""" | |
Скрипт для скачивания музыки с сайта vkontakte.ru (vk.com) | |
Запуск: | |
python vkcom_audio_download.py | |
Принцип работы: | |
Скрипт проверяет сохраненный access_token. Если его нет или срок истек, | |
то открывается страница в браузере с запросом на доступ к аккаунту. |
// $ scala-2.11.5 -Xexperimental | |
// Original Java 8 version: http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/ | |
scala> import java.util.{Arrays, List, ArrayList} | |
scala> import java.util.stream.{Stream, IntStream} | |
// List<String> myList = Arrays.asList("a1", "a2", "b1", "c2", "c1"); | |
scala> val myList = Arrays.asList("a1", "a2", "b1", "c2", "c1") |
# The MIT License (MIT) | |
# Copyright (c) 2016 Vladimir Ignatev | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the "Software"), | |
# to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the Software | |
# is furnished to do so, subject to the following conditions: | |
# |
<!-- place this in an %angular paragraph --> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.5/leaflet.css" /> | |
<div id="map" style="height: 800px; width: 100%"></div> | |
<script type="text/javascript"> | |
function initMap() { | |
var map = L.map('map').setView([30.00, -30.00], 3); | |
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
import boto3 | |
print(boto3.client('sts').get_caller_identity()['Account']) |
Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups
command.
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe
Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.