Skip to content

Instantly share code, notes, and snippets.

@tankala
tankala / vuex-persist-could-not-resolve-dependency.md
Last active December 18, 2022 14:33
Unable to install vuex-persist due to dependency resolve issue

Due to dependency issues I got this error

npm ERR! Found: vue@2.7.14
npm ERR! node_modules/vue
npm ERR! vue@"^2.7.10" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.2.0" from vuex@4.1.0
npm ERR! node_modules/vuex
@tankala
tankala / appArmorDockerProfileCorrpution.md
Created May 23, 2021 11:53
AppArmor docker profile corrpuption problem

Due to a file corruption or some reason I started getting below error

AppArmor enabled on system but the docker-default profile could not be loaded: strconv.Atoi: parsing "found": invalid syntax

I followed below steps to fix this problem. Please take backup of AppArmor profiles if you created any before running below commands

sudo rm -rf /etc/apparmor*
@tankala
tankala / README.md
Last active April 14, 2023 11:46
Redis key expire listener

Redis key expire listener

This code listens to redis key expire notifications

Installation

Set config in Redis config file as "notify-keyspace-events Ex"

pip3 install redis
@tankala
tankala / data.json
Last active March 2, 2022 08:31
Write/Convert Nested JSON data to CSV for all keys or specific keys. For more details read my article https://blog.tanka.la/2020/03/29/write-convert-nested-json-data-to-csv-for-specific-subset-keysheaders/
[
{
"_id": "5e7f55e2f065ef934a048d32",
"index": 0,
"guid": "88647c07-bf2a-42c3-8e23-cec1ed731f2f",
"isActive": false,
"balance": "$1,254.74",
"picture": "http://placehold.it/32x32",
"age": 40,
"eyeColor": "green",
@tankala
tankala / asyncQueueExample.js
Last active February 11, 2019 07:40
Async Queue Example
const async = require('async');
//Code for processing the task
var processQueue = function (message, callback) {
setTimeout(function() {
console.log(`Task ${message} completed`);
callback();
}, 500);
}
@tankala
tankala / asyncQueueExample.js
Created February 11, 2019 07:35
Async Queue Example
const async = require('async');
var processQueue = function (message, callback) {
setTimeout(function() {
console.log(`Task ${message} completed`);
callback();
}, 500);
}
var queue = async.queue(processQueue, 3);
@tankala
tankala / animalSoundsFeeder.js
Created January 9, 2019 07:22
Node.js Example for Redis Hashes
const readline = require('readline');
const redisClient = require('redis').createClient();
const userInteractor = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var initiateUserInteraction = async function() {
while(true) {
@tankala
tankala / MountainCarDataPreperation.py
Last active October 19, 2018 16:47
For preparing data of MountainCar game which we need to use for our deep learning model training.
def model_data_preparation():
training_data = []
accepted_scores = []
for game_index in range(intial_games):
score = 0
game_memory = []
previous_observation = []
for step_index in range(goal_steps):
action = random.randrange(0, 3)
observation, reward, done, info = env.step(action)
@tankala
tankala / CartPoleGamePlayWithDeepLearning.py
Last active October 19, 2018 12:51
With deep learning model playing CartPole game
scores = []
choices = []
for each_game in range(100):
score = 0
prev_obs = []
for step_index in range(goal_steps):
env.render()
if len(prev_obs)==0:
action = random.randrange(0,2)
else:
@tankala
tankala / CartPoleDataPreperation.py
Last active January 9, 2019 20:10
For preparing data of CartPole game which we need to use for our deep learning model training.
def model_data_preparation():
training_data = []
accepted_scores = []
for game_index in range(intial_games):
score = 0
game_memory = []
previous_observation = []
for step_index in range(goal_steps):
action = random.randrange(0, 2)
observation, reward, done, info = env.step(action)