Skip to content

Instantly share code, notes, and snippets.

@Kalki5
Kalki5 / better_bash.sh
Last active April 10, 2020 08:10
Ubuntu Better Bash
#!/bin/bash
apt update
apt install -y powerline fonts-powerline
#wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
#wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
#mv PowerlineSymbols.otf /usr/local/share/fonts/
#fc-cache -vf /usr/local/share/fonts/
#mv 10-powerline-symbols.conf /etc/fonts/conf.d/
@Kalki5
Kalki5 / AWS Custom Logs
Created January 10, 2018 10:59
AWS Push Custom Logs to Cloud Watch logs
sudo apt-get install -y python-pip
pip install awscli
aws configure
curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O
sudo python ./awslogs-agent-setup.py --region us-east-1
@Kalki5
Kalki5 / Quick Samba file server on Ubuntu
Created February 18, 2018 13:35
Installing samba server on ubuntu. Use map network drive in windows to connect to the linux samba server
sudo apt-get update
sudo apt-get install samba
sudo smbpasswd -a <user_name>
sudo vim /etc/samba/smb.conf
[<folder_name>]
path = /<folder_path_to_share>
valid users = <user_name>
read only = no
wget https://d1wk0tztpsntt1.cloudfront.net/linux/latest/install
sudo bash install
sudo /opt/aws/awsagent/bin/awsagent status
sudo /etc/init.d/awsagent stop
sudo /etc/init.d/awsagent start
@Kalki5
Kalki5 / Install VNC server on Ubuntu
Last active June 21, 2021 15:54
Install VNC server on Ubuntu with GCC, Gedit, Mate terminal and Google Chrome
sudo su
adduser hadoop
usermod -aG sudo hadoop
su - hadoop
sudo vim /etc/ssh/sshd_config
PasswordAuthentication yes
sudo service sshd restart
@Kalki5
Kalki5 / Install AWS Cloud Watch Agent - EC2 instance profile IAM policy
Last active April 14, 2018 13:45
Install AWS Cloud Watch Agent on Ubuntu. Custom Logs and custom metrics
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams"
import urllib, json
import requests
import boto3
client = boto3.client(
service_name='sts',
region_name='us-east-2',
aws_access_key_id='ACCESS_KEY',
aws_secret_access_key='SECRET_KEY'
)
import boto3
import json
lambda_client = boto3.client(
service_name='lambda',
region_name='us-east-2',
aws_access_key_id='ACCESS_KEY',
aws_secret_access_key='SECRET_KEY'
)
@Kalki5
Kalki5 / next.json-generator.com
Created March 3, 2018 07:16
Dummy json generator
[
{
'repeat(30, 60)': {
"model": "common.job",
"pk": '{{index()}}',
"fields": {
"title": '{{lorem(1, "words")}}',
"company_id": '{{integer()}}',
"level": '{{random("beginner", "intermediate", "expert")}}',
"location": "{{country()}}",
@Kalki5
Kalki5 / common.conf
Last active April 26, 2018 05:48
Deploy django 2.0.2 (REST app) on Ubuntu 16.04 with apache 2.4, python 3.6 and mod_wsgi
NameVirtualHost *:80
<VirtualHost *:80>
ServerName job.api.XXXXX.XXX
ServerAlias job
ServerAdmin webmaster@localhost
SetEnv DJANGO_SETTINGS_MODULE job_service.settings.production
<Directory /var/www/html/job.service/job_service>