This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int getId(String queryId, String queryParameter, String objectName) { | |
try (PreparedStatement preparedStmt = getConnection().prepareStatement(queryId)) { | |
preparedStmt.setString(1, queryParameter); | |
ResultSet u = preparedStmt.executeQuery(); | |
if (u.next()) { | |
return u.getInt("id"); | |
} | |
throw new SQLException(objectName + " does not exists"); | |
} catch (SQLException e) { | |
e.printStackTrace(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
F recurse_hash(h:Hash, cb:Fun) { | |
F is_not_hash(x) x is not Hash | |
h.tr(is_not_hash -> F(val, ctx) { | |
cb(val, ctx._path) | |
}) | |
} | |
test("recurse_hash(Hash, Fun) sum", { | |
h = { | |
'a': {'b': 2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Following line will be needed when files will be auto-wrapped in "ns { ... }" | |
{ global deep_get, deep_set, deep_get_step, deep_set_step, deep_index_to_container_type } | |
doc %STATUS - experimental | |
F deep_get_step(node, _) { | |
throw LookupFail().set(container=node) | |
} | |
doc %STATUS - experimental | |
F deep_set_step(container, idx_or_key, next_idx_or_key) throw NotImplemented() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ngs | |
# Turn rules parsing debugging with "DEBUG=rules" environment variable setting | |
COMMENT_PREFIX = 'aws-migration-' | |
INT_NUMBER_REGEX = /^[0-9]+$/ | |
F is_ip(x:Str) { | |
octets = x.split('.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ngs | |
# This script is rough translation of https://gist.github.com/shokoe/e7b4d80b63ea5931ba23bcad1c7684d4 | |
# The translation was made as part of thinking about scripting by both parties: @shokoe, @ilyash-b | |
# The script was changed to match @ilyash-b's environment | |
# Starts new instance with same settings as given instances from backup AMI of the given instance | |
# Syntax: ec2_kamino.ngs <ENV> <ROLE> | |
# Syntax: ec2_kamino.ngs <INSTNACE_ID> | |
# If ENV and ROLE are given, finds the latest instance which has backup AMI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ngs | |
# This script is rough translation of https://gist.github.com/shokoe/e7b4d80b63ea5931ba23bcad1c7684d4 | |
# The translation was made as part of thinking about scripting by both parties: @shokoe, @ilyash-b | |
# Syntax: ec2_kamino.ngs <source instance 'Name' tag> [target new instance 'Name' tag]. | |
# If target name is not given <source name>-clone is used. | |
# Description: Builds a temporary template from a given instance and runs the latest found ami from that template. | |
# New instance settings can be overriden by OVERRIDES. | |
# AMI selection is filtered by AMI_SELECT_TAGS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ngs < Formula | |
desc "Next Generation Shell" | |
homepage "https://ngs-lang.org" | |
# url "https://github.com/ngs-lang/ngs/archive/v0.2.6.tar.gz" | |
url "https://github.com/ngs-lang/ngs/archive/69d761c84f45072e439e31b8cd70271e0862d406.tar.gz" | |
version "0.2.7-alpha" | |
# sha256 "22b8c371dcb6d55d0ff4f227b66523cdb07a15ff8ede72ff05cc9c478e67f1ca" | |
depends_on "bdw-gc" => :build | |
depends_on "cmake" => :build | |
depends_on "gnu-sed" => :build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FromPathLoader): loading /Users/ilya/Downloads/ngs.rb | |
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/awk.rb | |
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/bdw-gc.rb | |
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libatomic_ops.rb | |
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/pkg-config.rb | |
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/cmake.rb | |
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ngs | |
F main(list_name:Str) { | |
AUTH = "?key=${ENV.TRELLO_API_KEY}&token=${ENV.TRELLO_API_TOKEN}" | |
board = ``curl -s "https://api.trello.com/1/members/me/boards${AUTH}"``.the_one({"name": /personal/}) | |
list = ``curl -s "https://api.trello.com/1/boards/${board.id}/lists${AUTH}&cards=open"``.the_one({"name": list_name}) | |
tag = list.name.split(' ')[0] | |
pfx = "[${tag}] " | |
list.cards.reject({'name': Pfx('[')}).each(F(card) { | |
echo("${card.name} -> ${pfx}${card.name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By zzamboni | |
fn find-key [tree key]{ | |
if (eq (kind-of $tree) map) { | |
keys $tree | each [k]{ | |
if (eq $k $key) { | |
put $tree[$k] | |
} else { | |
find-key $tree[$k] | |
} | |
} |
NewerOlder