Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Avi Parshan avipars

🎯
Focusing
View GitHub Profile
@avipars
avipars / IP.ps1
Created Mar 30, 2021
Powershell detect if current IP is different than your previous one
View IP.ps1
$uri = "https://whatismyip.host/ip4"
$ipv4 = (Invoke-WebRequest -uri $uri).Content
$currentip = "your.current.public.ip4"
$val = $true
:loop while ($val) {
if($ipv4 -ne $currentip){
Write-Output "not equal - $ipv4 vs $currentip"
@avipars
avipars / first.txt
Created Feb 27, 2021
Android Medium Articles
View first.txt
Updating data in an Android RecyclerView
Suragch
Suragch
Dec 22, 2018·4 min read
This is a repost of an answer I wrote on Stack Overflow.
There are two main things that I find helpful when exploring a new API: seeing examples (especially ones with pictures) and just trying out all the possibilities. This post will hopefully help you with that as you are learning how to update the adapter data in an Android RecyclerView. If you need help setting up the RecyclerView itself, then see this post or scroll down to the Code section below.
Overview
@avipars
avipars / weather.yaml
Created Feb 9, 2021
HASS Weather notification
View weather.yaml
service: notify.notify
data:
title: Tomorrow's forecast
message: >-
Expect {{state_attr("weather.home", "forecast")[0].condition}} conditions
with high of {{state_attr("weather.home", "forecast")[0].temperature}}
degrees, and {{state_attr("weather.home", "forecast")[0].humidity}} %
humidity
View vatstyles.css
@import url("https://fonts.googleapis.com/css?family=Montserrat");
html,
body {
height: 100%;
margin: 0;
padding: 0;
font-family: "Montserrat", sans-serif;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am avipars on github.
  • I am aviparshan (https://keybase.io/aviparshan) on keybase.
  • I have a public key whose fingerprint is ADDB 81D9 B5E9 63C9 A3F5 9DDE C91E 7A25 AA10 1E68

To claim this, I am signing this object:

View layout.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relative"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
View ic_launcher.xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
@avipars
avipars / AndroidMaifest.xml
Last active Apr 30, 2020
unitMeasure - Get Intents
View AndroidMaifest.xml
<activity
android:name=".activities.Main"
android:configChanges="orientation"
android:label="@string/app_name"
android:resizeableActivity="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
@avipars
avipars / Solution.java
Last active Apr 15, 2020
Java Code Answer for Number of Steps to Reduce a Number to Zero. https://link.medium.com/nqICUGZMH5
View Solution.java
class Solution {
// article: https://link.medium.com/nqICUGZMH5
public int numberOfSteps (int num) {
int step = 0;
while(num!= 0)
{
if(num % 2 == 0) //even
{
step++;
num=num/2;
@avipars
avipars / item.xml
Created Apr 6, 2020
Badge for my app
View item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relative"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"