Skip to content

Instantly share code, notes, and snippets.

View Ujjwal0501's full-sized avatar

Ujjwal Kumar Ujjwal0501

  • Surat, Gujarat, India
View GitHub Profile
#include <iostream>
using namespace std;
int level = 0;
int digitsum(long long int n) {
int result = 0;
while (n) {
result += n%10;
n /= 10;
@Ujjwal0501
Ujjwal0501 / escape1.cpp
Created October 19, 2018 06:38
scan integer in identifier of type double using cin
#include <iostream>
#include <iomanip>
using namespace std;
int main(void) {
double x, va, vb;
cin >> x >> va >> vb;
// scanf("%lf %lf %lf", &x, &va, &vb);
// following line of code prints integers
cout<< x << " " << va << " " << vb << "\n";
http://wknc.sma.ncsu.edu:8000/wknchq.ogg.m3u (radio)
https://stream.wuvt.vt.edu/wuvt-hq.ogg
http://ubuntu.hbr1.com:19800/trance.ogg
http://ubuntu.hbr1.com:19800/ambient.ogg
# sessionStorage
store a value `sessionStorage["key"] = "value";`
## Store multiple values
- to store values "one", "two", "three"
store as follows : `sessionStorage['key"] = ["one", "two", "three"];`
- to retrieve multiple values stored use as follows
`var array = sessionStorage["key"].toString().split(",");`
install adb and adb-fastboot in ubuntu
`sudo apt install android-tools-adb android-tools-fastboot`
Enable USB Debugging on Your Android Device
If you get the following error, `???????????? no permissions`
Then all you need to do is restart adb daemon, run
`sudo adb kill-server` and `sudo adb start-server`
reboot device command : `adb reboot`
@Ujjwal0501
Ujjwal0501 / install-libgraph.sh
Last active May 7, 2020 14:32
A bash script for intalling libgraph in ubuntu 20.04.
#!/bin/bash
sudo add-apt-repository universe
sudo apt-get update
count=$( cat /etc/apt/sources.list | grep "xenial main universe" -c )
if [ $count -lt 2 ]; then
sudo bash -c 'echo "deb http://us.archive.ubuntu.com/ubuntu/ xenial main universe
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main universe" >> /etc/apt/sources.list'
@Ujjwal0501
Ujjwal0501 / backup_android.sh
Last active July 31, 2022 21:18
Bash script to make a backup of the android user data
#!/bin/bash
LOG_FILE=~/android_backup.log
DISOLVE_DIRECTORY=0
if [[ $BACKUP_SRC -eq "" ]]; then BACKUP_SRC=storage/self/primary; fi
if [[ $BACKUP_DST -eq "" ]]; then BACKUP_DST=$HOME/AndroidBackup; fi
IFS=$'\n' # set the Internal Field Separator to newline for iterating over file and directory list output of ls
usage() { echo "Usage: $0 [-s <android-source-folder>] [-d <backup-directory-path>] [-m]\n\t-x " 1>&2; exit 1; }
stop() { echo "Exiting..."; echo "No backup made!!"; exit 0; }
#!/bin/sh
set -e
KEY_PATH="$HOME/localpairs"
# install necessary tools
sudo apt-get install git build-essential curl openssl mokutil -y
build_module () {
@Ujjwal0501
Ujjwal0501 / mv-docker-cache.sh
Created January 1, 2024 21:29
Change the default docker cache directory from /var/lib/docker to /home/docker-data
#!/bin/bash
set -e
FILE_PATH="/etc/docker/daemon.json"
# do not write if daemon.json already exists
if [ -e "$FILE_PATH" ]; then
echo "File ($FILE_PATH) already present. No changes made"
exit 1