Skip to content

Instantly share code, notes, and snippets.

View arajajyothibabu's full-sized avatar
🎯
Focusing

Jyothi Babu Araja arajajyothibabu

🎯
Focusing
View GitHub Profile
@arajajyothibabu
arajajyothibabu / script.js
Last active July 9, 2021 13:02
JavaScript utility to convert Ordered List tags into Table tags for better rendering in PDF
/*Coverts OL into Table tags*/
(function (root) {
var romanUpper = [
"",
"C",
"CC",
"CCC",
"CD",
"D",
"DC",
@arajajyothibabu
arajajyothibabu / index.html
Created November 2, 2020 09:09
JS Bin | Safari 14 transform: translate issue // source https://jsbin.com/behepig
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin | Safari 14 transform: translate issue</title>
<style id="jsbin-css">
.scroller {
height: 400px;
@arajajyothibabu
arajajyothibabu / index.html
Created November 2, 2020 09:08
JS Bin | Safari 14 transform: translate issue // source https://jsbin.com/gojinonefi
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin | Safari 14 transform: translate issue</title>
<style id="jsbin-css">
.scroller {
height: 400px;
width: 100%;
@arajajyothibabu
arajajyothibabu / getDOMElementSelector.js
Created April 23, 2019 10:43
Element Selector in DOM using JavaScript
const getSelector = (node) => {
let name = "";
if (node && node.localName) {
name = node.localName; //tag name
if (name === "html") { //DOM root FIXME: not sure with this
return name;
}
if (node.hasAttribute && node.hasAttribute("id")) { //checking for id
name += `#${node.getAttribute("id")}`;
} else {
@arajajyothibabu
arajajyothibabu / index.html
Last active April 23, 2019 10:41
JS Bin DOM Element Selector // source https://jsbin.com/tiwugob
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin | DOM Element Selector</title>
</head>
<body>
<div id="hello">
<div class="hi">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
#content{
}
h2{
@arajajyothibabu
arajajyothibabu / nvidia_ubuntu_xps.sh
Created November 14, 2018 13:19
Installing Nvidia in Ubuntu 18.04 Dell XPS 9570
sudo rm /etc/X11/Xorg.conf ## no worry if the file does not exist
sudo apt purge nvidia*
sudo apt update
sudo apt full-upgrade
sudo ubuntu-drivers autoinstall
@arajajyothibabu
arajajyothibabu / python_send_email.py
Created September 9, 2018 14:20
Sending email using Python and Gmail
import smtplib
from email.mime.text import MIMEText
def send_email():
from_address = '[email protected]'
to_addresses = [subscriber['email'] for subscriber in subscribers]
print "Sending emails to ", ", ".join(to_addresses)
msg = MIMEText(EMAIL_BODY, 'html')
msg["Subject"] = "Some Subject"
msg["From"] = from_address
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror [email protected]:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@arajajyothibabu
arajajyothibabu / wordCount.sh
Last active April 1, 2018 16:55
Shell script for words and their occurrences in a file
cat $1 | tr ' ' '\n' > temp # put all words to a new line
echo -n > file2.txt # clear file2.txt
for line in $(cat temp) # trace each line from temp file
do
# check if the current line is visited
grep -q $line file2.txt
if [ $? -ne 0 ]
then
count=`grep $line temp -o | wc -l` #count the number of words
echo $line"@"$count >> file2.txt # add word and frequency to file