Skip to content

Instantly share code, notes, and snippets.

View rajendarreddyj's full-sized avatar
💭
I may be slow to respond.

Rajendarreddy Jagapathi rajendarreddyj

💭
I may be slow to respond.
View GitHub Profile
@rajendarreddyj
rajendarreddyj / create_new_user.md
Created August 28, 2022 19:16 — forked from JeremyIglehart/create_new_user.md
How to create a new user and remove the `pi` user on a Raspberry Pi

How to create a new user and remove the pi user on a Raspberry Pi

Note: This has been tested in Rasbian Buster released on 2019-06-20

Important: replace jeremy below with whatever username you'd like as your new user.

  1. sudo adduser jeremy
    • You will be asked to enter a password
    • When filling out basic information about the user, you may leave it blank
@rajendarreddyj
rajendarreddyj / updateJDK.ps1
Created August 4, 2021 00:24 — forked from mavaddat/updateJDK.ps1
Automated update of JDK path for AdoptOpenJDK triggered by update in Chocolatey. PowerShell directives are provided to the VBS Windows Script Host as encoded commands so as to avoid a shell screen popping up on trigger.
# This contains two lines (#4, #7) which will be run as an encoded PowerShell command inside a Visual Basic Script (VBScript) scheduled task below.
# Check if 'updateJDK.vbs' is already running in another process; if so, let's quit and just let that finish the task
Get-Process -Name '*WScript*' | foreach{if($_.CommandLine -imatch 'updateJDK.vbs' -and $_.Id -ne $PID){ exit } }
# We will update the %JAVA_HOME% path upon observing discrepency between the newest available JDK (local directory) and the %JAVA_HOME%
$jdk = Get-ChildItem (Resolve-Path 'C:\Program Files\AdoptOpenJDK\') -Depth 0 -Directory | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 1; if(($null -ne ([System.Environment]::GetEnvironmentVariable('JAVA_HOME'))) -and ($env:JAVA_HOME -ne $jdk)) { [System.Environment]::SetEnvironmentVariable('JAVA_HOME',$($jdk.FullName),[System.EnvironmentVariableTarget]::User) }
# Whenever we change the script (i.e., the above line of PowerShell commands), we generate the new encoded command
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@rajendarreddyj
rajendarreddyj / git-apply-patch.md
Created May 14, 2021 04:43 — forked from emmanueltissera/git-apply-patch.md
Generate a git patch for a specific commit

Creating the patch

git format-patch -1 <sha>
OR
git format-patch -1 HEAD

Applying the patch

git apply --stat file.patch # show stats.
git apply --check file.patch # check for error before applying

@rajendarreddyj
rajendarreddyj / pi_mount_usb.md
Created May 7, 2021 02:15 — forked from etes/pi_mount_usb.md
How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

Follow the simple steps in the order mentioned below to have your USB drive mounted on your Raspberry Pi every time you boot it.

These steps are required especially if your are setting up a Samba share, or a 24x7 torrent downloader, or alike where your Raspberry Pi must have your external storage already mounted and ready for access by the services / daemons.

Step 0. Plug in your USB HDD / Drive to Raspberry Pi If you are using a NTFS formatted drive, install the following

@rajendarreddyj
rajendarreddyj / geojson-spec-1.1
Created April 20, 2021 19:41 — forked from virtualandy/geojson-spec-1.1
The GeoJSON Specification
================================
The GeoJSON Format Specification
================================
:Abstract:
GeoJSON is a geospatial data interchange format based on JavaScript Object
Notation (JSON).
:Authors:
Howard Butler (Hobu Inc.),
@rajendarreddyj
rajendarreddyj / index.html
Created April 20, 2021 03:44 — forked from milkbread/index.html
JavaScript: Leaflet Polygon Example
<!DOCTYPE html>
<html>
<head>
<title>Simple polygon visualisation</title>
<meta charset="utf-8" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
@import url(http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.css);
</style>
@rajendarreddyj
rajendarreddyj / npm-upgrade-bleeding.sh
Created March 2, 2020 01:08 — forked from othiym23/npm-upgrade-bleeding.sh
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
@rajendarreddyj
rajendarreddyj / adbhostgen.sh
Created November 21, 2018 15:44 — forked from m-parashar/adbhostgen.sh
Create mega adblock hosts-file for use with DD-WRT
#!/bin/sh
# set -euxo pipefail
# File: adbhostgen.sh
#
# Script to generate massive block lists for DD-WRT
#
# AUTHOR: Manish Parashar
#
# https://github.com/m-parashar/adbhostgen
# https://gist.github.com/m-parashar/ee38454c27f7a4f4e4ab28249a834ccc
# Let’s see all the packages marked as rc by dpkg. Know more about the state rc.
# This state means that the configuration files are not yet removed. You can see how a single package can be removed.
# $ dpkg --list |grep "^rc"
# rc bsh 2.0b4-10ubuntu2 Java scripting environment (BeanShell) Versi
# rc devicekit-disks 007-2ubuntu6 abstraction for enumerating block devices
# rc devicekit-power 011-1ubuntu2 abstraction for power management
# rc dvipdfmx 1:20090115-1.2 A DVI to PDF translator with CJK support
# rc gnome-blackjack 1:2.28.0-0ubuntu3 Blackjack casino card game
# rc groovy 1.6.4-4ubuntu2