Skip to content

Instantly share code, notes, and snippets.

View khandelwal-aman's full-sized avatar

Aman Khandelwal khandelwal-aman

View GitHub Profile
const { ActivityHandler } = require('botbuilder');
var sql = require("mssql");
var config = {user: 'Bi_Auto',
password: '',
server: '',
database: 'edw_prod',
encrypt: true
};
class EchoBot extends ActivityHandler {

command to restart MySQL

sudo /etc/init.d/mysql restart

overwriting MySQL Config File

cd /etc/mysql cd mysql.conf.d/

@khandelwal-aman
khandelwal-aman / ubuntu_mssql_driver_install_steps.txt
Last active January 22, 2020 10:18
Commands to enable mssql on Ubuntu
sudo apt-get install unixodbc
curl https://packages.microsoft.com/config/ubuntu/18.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
@khandelwal-aman
khandelwal-aman / python_cron.sh
Created January 21, 2020 09:40
Cron file example for python script alongwith crontab entry
#!/bin/bash
cd /home/administrator/projects/ctim
#source bin/activate
/home/administrator/projects/ctim/bin/python program.py
#Crontab command
#0 13 * * * /home/administrator/projects/ctim/run.sh >> /home/administrator/projects/ctim/py.log
@khandelwal-aman
khandelwal-aman / swap_size_change.txt
Last active January 21, 2020 09:22
Swap memory size change in ubuntu
1. Turn off all swap processes
sudo swapoff -a
2. Resize the swap
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
if = input file
of = output file
bs = block size
count = multiplier of blocks
https://phpchart.com/examples/complete-phpchart-examples/#!prettyPhoto
https://www.rgraph.net/demos/bar-segmented.html
#removes all exited docker containers and clears memory
docker rm -v $(docker ps -a -q -f status=exited)
Was getting:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
I ran sudo dockerd --debug and got:
failed to start daemon: mkdir /var/lib/docker/runtimes: not a directory
Solution:
sudo rm /var/lib/docker/runtimes
@khandelwal-aman
khandelwal-aman / jsonstream.py
Created November 6, 2019 07:09
json stream reader to read one row from json stream at a time. Useful for large json data
import ijson
filename = "events.json"
with open(filename, 'r') as f:
for row in ijson.items(f, 'item'):
print(row)