Skip to content

Instantly share code, notes, and snippets.

View Varriount's full-sized avatar

Clay Sweetser Varriount

View GitHub Profile
import v4
import strformat
import strutils
import httpcore
import times
import httpclient
proc main =
let
region = "ap-southeast-1"
proc readElementInto(
dest: var DescribeAvailabilityZonesResult,
parser: var XmlParser,
elementName: string): int =
result = 0
if parser.elementName != elementName:
return 0
var readCount = 0
while readCount < 1:
import strutils
import tables
import algorithm
import httpcore
import unicode
import strformat
import times
import nimcrypto
import httpclient
import utils
int main()
{
printf("\nvoid pointer: %d", sizeof(void*));
return 0;
}
{
"check.on_save.list.move_cursor": false,
"check.on_save.list.show_errors": false,
"check.on_save.list.show_warnings": false,
"check.on_save.output.send": true,
"check.on_save.output.show": true,
"check.on_save.output.name": "Nim Check - Current File",
"check.on_save.output.method": "console",
"check.on_save.output.clear": false,
main.nim(33, 28) Hint: 219042 [Processing]
main.nim(34, 28) Hint: 219042 [Processing]
main.nim(35, 1) Hint: 219042 [Processing]
main.nim(37, 1) Hint: 219062 [Processing]
main.nim(44, 1) Hint: 219109 [Processing]
main.nim(71, 87) Warning: cannot prove that field 'event.key' is accessible [ProveField]
main.nim(90, 30) template/generic instantiation from here
lib/pure/collections/sequtils.nim(109, 18) template/generic instantiation from here
lib/system.nim(2399, 14) template/generic instantiation from here
lib/system.nim(2393, 9) Warning: 'result' might not have been initialized [Uninit]
proc condense_whitespace(input: string): string =
result = ""
# Calculate start position
var startPosition = 0
while startPosition < len(input):
if input[startPosition] != ' ':
break
inc(startPosition)
@Varriount
Varriount / sigv4.nim
Created November 2, 2017 04:29
Optimized sigv4.nim
#[
# AWS SignatureV4 Authorization Library
Implements functions to handle the AWS Signature v4 request signing
http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
]#
import os, times
import strutils except toLower
import sequtils, algorithm, tables, nimSHA2
import securehash, hmac, base64, re, unicode
{
"version":"2.0",
"metadata":{
"apiVersion":"2015-10-01",
"endpointPrefix":"gamelift",
"jsonVersion":"1.1",
"protocol":"json",
"serviceFullName":"Amazon GameLift",
"signatureVersion":"v4",
"targetPrefix":"GameLift",
@Varriount
Varriount / s3_get_bucket_obj.nim
Last active October 25, 2017 06:29 — forked from Gooseus/s3_get_bucket_obj.nim
Testing async dispatch and http requests in Nim
# testing async dispatch in pursuit of an efficient async s3 interface
import os, times, math, httpclient, asyncdispatch, asyncfile
let t0 = epochTime()
proc dt() : float =
round(epochTime() - t0,6)
const aws_url = "http://localhost:1234/"