Skip to content

Instantly share code, notes, and snippets.

@ivankatliarchuk
ivankatliarchuk / DynamoEnumConverter
Created December 27, 2019 21:13 — forked from jvwing/DynamoEnumConverter
For use with Amazon DynamoDB DataModel API for .NET. This class can be used to automagically serialize enum properties to DynamoDB, by decorating the property with the attribute [DynamoDBProperty(typeof(DynamoEnumConverter<AccountStatus>))], where "AccountStatus" is the name of the enumerated type..
public class DynamoEnumConverter<TEnum> : IPropertyConverter
{
public object FromEntry(DynamoDBEntry entry)
{
string valueAsString = entry.AsString();
TEnum valueAsEnum = (TEnum)Enum.Parse(typeof(TEnum), valueAsString);
return valueAsEnum;
}
public DynamoDBEntry ToEntry(object value)
@ivankatliarchuk
ivankatliarchuk / updateSecurityGroup.js
Created December 25, 2019 09:26 — forked from rowanu/updateSecurityGroup.js
Update an AWS Security Group to allow access by a specific AWS service.
'use strict';
const AWS = require('aws-sdk');
const https = require('https');
const ec2 = new AWS.EC2();
const ipRangesUrl = 'https://ip-ranges.amazonaws.com/ip-ranges.json';
const target = {
port: 5432,
protocol: 'tcp',
from multiprocessing import Process
def sub(myredis, name):
pubsub = myredis.pubsub()
pubsub.subscribe(['tasks'])
for item in pubsub.listen():
print('%s : %s' % (name, item['data']))
if __name__ == "__main__":
# main()
@ivankatliarchuk
ivankatliarchuk / Jenkinsfile
Created May 17, 2019 19:14 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
@ivankatliarchuk
ivankatliarchuk / gist:18c6506816a11e3264fe62b5be42e45d
Created December 20, 2018 23:55 — forked from Miuler/gist:4134020
Benchmarks for Gatling: Gatling's simulation
package jmeter
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import bootstrap._
class JMeterBenchmark extends Simulation {
def apply = {

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@ivankatliarchuk
ivankatliarchuk / GPG and git on macOS.md
Created September 9, 2018 09:55 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@ivankatliarchuk
ivankatliarchuk / console.sql
Created August 4, 2015 20:11
left outer join
SELECT product.model, count(pc.model) FROM product
LEFT OUTER JOIN pc
ON product.model = pc.model
GROUP BY product.model;
SELECT model FROM product
WHERE model NOT IN (
SELECT model FROM pc);
SELECT * FROM asterisk.cdr main
WHERE DATE(main.calldate) BETWEEN '2015-07-01' AND '2015-07-30'
AND main.record_id IN (
SELECT item.record_id FROM asterisk.cdr item
WHERE item.calldate IS NOT NULL
AND HOUR(item.calldate) BETWEEN '8:00:00' AND '21:00:00'
);