Skip to content

Instantly share code, notes, and snippets.

View azizur's full-sized avatar

Azizur Rahman azizur

View GitHub Profile
@Gumnos
Gumnos / bs.py
Created February 10, 2022 01:17
Bookstore simulator
from random import randint
def d6():
return randint(1,6)
day = money = 0
time = patience = 10
while day < 10 and money < 10:
day += 1
@igilham
igilham / dynamodbcp.py
Last active August 28, 2018 09:31
Copy all data (by scanning) from one DynamoDB table to another
from __future__ import print_function
import argparse
import boto3
def copy_table(source, target):
dynamodb = boto3.resource("dynamodb")
source_table = dynamodb.Table(source)
target_table = dynamodb.Table(target)
@superjose
superjose / .gitlab-ci.yml
Last active February 19, 2024 10:22
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
@singledigit
singledigit / cognito.yaml
Last active December 11, 2024 10:03
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation sample template that contains a single Lambda function behind an API Gateway",
"Resources": {
"GreetingLambda": {
"Type": "AWS::Lambda::Function",
"Properties": {
@JosephMaxwell
JosephMaxwell / jenkins.template
Last active January 27, 2022 00:38
Jenkins CloudFormation Template (more information and tutorial videos at https://swiftotter.com/technical/running-jenkins-on-amazon-ec2-with-cloudformation)
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Launches a Jenkins server.",
"Parameters": {
"InstanceType": {
"Description": "EC2 instance type",
"Type": "String",
"Default": "t2.small",
"AllowedValues": [
"t1.micro",
@dreikanter
dreikanter / encrypt_openssl.md
Last active January 4, 2025 05:20 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@BryanSchuetz
BryanSchuetz / concat.liquid
Created May 5, 2016 16:20
Concat arrays in Jekyll(liquid)
{% assign all_hosts = "" | split: "" %}
{% for host in site.data.shared_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
{% for host in site.data.paas_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
@tap52384
tap52384 / erlangc.php
Created December 18, 2015 21:38
PHP class for calculating the Erlang-C Formula as explained here: http://mitan.co.uk/erlang/elgcmath.htm
<?php
/**
* Time unit defaults to seconds to follow the example shown here:
* http://mitan.co.uk/erlang/elgcmath.htm
* exp calculates e to some specified exponent:
* https://secure.php.net/manual/en/function.exp.php
* factorial function for php:
* http://www.hackingwithphp.com/4/18/0/recursive-functions
* Basically, all calculated values are private.
@JSONObject
public class Slideshow {
@JsonField(name = "id")
int mSlideshowId;
@JsonField(name = "created_at")
long mCreatedAt;
@JsonField(name = "title")
String mTitle;
@JsonField(name = "user_id")
int mUserId;