Skip to content

Instantly share code, notes, and snippets.

View asraful's full-sized avatar

Asraful Forhad Chowdhury asraful

  • Independent Contractor
  • Tampere,Finalnd
  • X @AsrafulC
View GitHub Profile
@asraful
asraful / dbeaver.ini
Created June 9, 2023 08:07 — forked from souhaiebtar/dbeaver.ini
[dbeaver config file] .ini file for dbeaver #dbeaver #linux
# path on linux /usr/share/dbeaver/dbeaver.ini
# path on macos /Applications/DBeaverEE.app/Contents/Eclipse/dbeaver.ini
-vm
/usr/bin/java
-startup
plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.1100.v20190907-0426
-vmargs
-XX:+IgnoreUnrecognizedVMOptions
@asraful
asraful / get_cloudwatch_logs.py
Created July 12, 2021 16:02 — forked from eldondevcg/get_cloudwatch_logs.py
Pull down cloudwatch logs with boto
# IF YOU INCUR HUGE COSTS WITH THIS OR IT BREAKS DON'T BLAME ME License
# This is a throw-away script I wrote to pull the json events for all of the streams from a cloudwatch log
# For some reason, the naive way to do vpc network logging does logging to different streams in a cloudwatch
# log based on interface.
# Great for diagnosing lots of things, and generating verbose logs, but for the broad-stroke analysis I was doing,
# all I really wanted was the basic data. This would have been easier if I had logged to s3, but I did not see a
# way to do that in 2 clicks.
group_name = 'CHANGEME'
Step 1: Configure the Amazon ECS CLI
ecs-cli configure --cluster ec2-tutorial --default-launch-type EC2 --config-name ec2-tutorial --region us-west-2
ecs-cli configure profile --access-key AWS_ACCESS_KEY_ID --secret-key AWS_SECRET_ACCESS_KEY --profile-name ec2-tutorial-profile
Step 2: Create Your Cluster
ecs-cli up --keypair id_rsa --capability-iam --size 2 --instance-type t2.medium --cluster-config ec2-tutorial --ecs-profile ec2-tutorial-profile
Step 1: Download the Amazon ECS CLI
sudo curl -Lo /usr/local/bin/ecs-cli https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-linux-amd64-latest
Step 2: Verify the Amazon ECS CLI using PGP signatures
curl -Lo ecs-cli.asc https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-linux-amd64-latest.asc
Step 3: Apply Execute Permissions to the Binary
sudo chmod +x /usr/local/bin/ecs-cli
@asraful
asraful / azuredeploy.json
Created March 19, 2021 15:05 — forked from dzeyelid/azuredeploy.json
Sample of ARM template to deploy Azure Database for MySQL.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters":{
"databaseForMySqlAdminName": {
"type": "string"
},
"databaseForMySqlAdminPassword": {
"type": "securestring"
},
app.get('/demo', (req, res) => {
const { createCanvas, loadImage } = require('canvas')
var sizeOf = require('image-size');
var dimensions = sizeOf('sample.jpg');
const width = dimensions.width;
const height = dimensions.height;
1. Naviagte to the directory and execute bellow command :
sudo docker build . -f Dockerfile
2.Tag the build image :
sudo docker tag <image id > rmlregistry.azurecr.io/<name>:latest
3. Login to azure registry
@asraful
asraful / cron_backup_data_to_s3_bucket
Created September 2, 2020 10:22
Write a cron job used in EC2 to backup data from ec2 to certain s3 bucket
#!/bin/sh
WK_DIRECTORY=$1
WK_BUCKET=$2
JOB_INTERVAL=$3
pip install --user awscli --upgrade
command="/usr/local/bin/aws s3 sync $WK_DIRECTORY s3://$WK_BUCKET"
# ------------------------------------------------------------------------------
# Sample Configuration file : config.txt
# [rds_config]
# run_rds_test_scripts = false
#
# [mysql]
# arn = "any_value"
# host = "any_value"
#------------------------------------------------------------------------------
@asraful
asraful / logback.xml
Created December 3, 2019 09:33 — forked from HaVonTe1/logback.xml
logback - print filename and line number
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>myapp.log</file>
<encoder><pattern>%logger{35} - [%F:%L] - %msg%n</pattern></encoder>
</appender>
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="FILE" />
<!-- add the following line -->
<includeCallerData>true</includeCallerData>