Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
🎯
Focusing

Karthik Sirasanagandla karthiks

🎯
Focusing
View GitHub Profile
@karthiks
karthiks / package.json
Created March 30, 2020 17:23
husky-configuration-sample
{
"name": "my_javascript_project",
"version": "1.0.0",
"description": "my company's bread-earning project",
...
"scripts": {
"lint": "./node_modules/.bin/eslint ./app/**/*.*js* --fix",
...
},
"husky": {
@karthiks
karthiks / multiple-files-remove-prefix.md
Created December 29, 2019 04:59
Remove prefix from multiple files in Linux console

Bash

for file in prefix*; do mv "$file" "${file#prefix}"; done;

The for loop iterates over all files with the prefix. The do removes from all those files iterated over the prefix.

Here is an example to remove "bla_" form the following files:

bla_1.txt
bla_2.txt
@karthiks
karthiks / example.html
Last active May 17, 2020 14:38 — forked from andrewlimaza/example.html
Print certain div / elements using window.print()
<script>
function printDiv(divID){
var printContents = document.getElementById(divID).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
# To enable mouse scroll in tmux pane
set -g mouse on
# Tmux to support colors
set -g default-terminal "screen-256color"
# Change the default prefix from C-b to C-z
set -g prefix C-z
unbind C-b
@karthiks
karthiks / install_minikube_ubuntu1810.sh
Last active January 28, 2019 11:57
Steps to install minikube on ubuntu 18.10
# Note of thanks: This code snippet is created using https://carbon.now.sh. Check it out!
# Update the system
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get upgrade
# Install KVM or VirtualBox or both
# I prefer KVM
# Installing virtualbox
@karthiks
karthiks / install_vbox60_ubuntu1810.sh
Created January 28, 2019 11:00
How to Install VirtualBox 6.0 on Ubuntu 18.10
# Open the terminal and run the following commands:
# Add VirtualBox 6 repo keys
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
# Enable VirtualBox 6.0 repository
sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
sudo apt-get update
@karthiks
karthiks / enhanced-form.js
Last active April 2, 2018 10:48
Submit form at the click of an Enter/Return button
class EditTaskModal extends Component {
.
.
.
render() {
return (
<form onSubmit={(e)=>this.modifyTask(e)}>
<input className="ToDoInput" value={this.state.task} onChange={this.handleEditingTask} />
<button type="submit" className="ToDoSubmit"> Edit </button>
</form>
@karthiks
karthiks / simple-form.js
Last active April 2, 2018 10:36
Edit row item in a table at button click in a modal dialog using ReactJS
class EditModal extends Component {
.
.
.
render() {
return (
<input className="ToDoInput" value={this.state.task} onChange={this.handleEditingTask} />
<button onClick={(e)=>this.modifyTask(e)} className="ToDoSubmit"> Edit </button>
);
}
private NotificationUtils notificationUtils;
//..
public void someMethod() {
notificationUtils = new NotificationUtils(this);
notificationUtils.getNotificationManager().notify(random_id, getAndroidChannelNotification(title, body));
}
//..