Skip to content

Instantly share code, notes, and snippets.

View kayandra's full-sized avatar
🏠
Working from home

Samuel Oloruntoba kayandra

🏠
Working from home
View GitHub Profile
@kayandra
kayandra / rn-with-wsl-wsa.md
Created May 23, 2023 06:21 — forked from nkt217/rn-with-wsl-wsa.md
Develop React Native app with WSL and WSA

Develop React Native app with WSL and WSA

Requirement

  • Windows Subsystem for Linux 2 (WSL2)
  • Windows Subsystem for Android (WSA)
  • NodeJS install inside WSL2

Steps

WSA

Assigning Static IP Addresses in WSL2

WSL2 uses Hyper-V for networking. The WSL2 network settings are ephemeral and configured on demand when any WSL2 instance is first started in a Windows session. The configuration is reset on each Windows restart and the IP addresses change each time. The Windows host creates a hidden switch named "WSL" and a network adapter named "WSL" (appears as "vEthernet (WSL)" in the "Network Connections" panel). The Ubuntu instance creates a corresponding network interface named "eth0".

Assigning static IP addresses to the network interfaces on the Windows host or the WSL2 Ubuntu instance enables support for the following scenarios:

@kayandra
kayandra / WSL2-Net-Fix.ps1
Created May 23, 2023 06:03 — forked from danvy/WSL2-Net-Fix.ps1
Reset your WSL network connection trying to fix WSL2 media disconnected error
# Check these threads before proceeding:
# https://github.com/microsoft/WSL/discussions/5857
# https://github.com/microsoft/WSL/issues/5821
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$CmdLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CmdLine
Exit
}
# Restart the Host Network Service
Restart-Service -Force -Name hns
@kayandra
kayandra / rearct-native-app-in-wsl2.md
Created February 26, 2023 18:10 — forked from bergmannjg/rearct-native-app-in-wsl2.md
Building a react native app in WSL2
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
module nfts::marketplace_nofee {
use sui::tx_context::{Self, TxContext};
use sui::object::{Self, UID, ID};
use sui::transfer;
use sui::dynamic_object_field as ofield;
use sui::coin::{Self, Coin};
use sui::balance::{Self, Balance};
@kayandra
kayandra / token_account_helper.ts
Created January 8, 2022 20:20 — forked from losman0s/token_account_helper.ts
Token accounts for owner
import * as BufferLayout from "buffer-layout";
import {
AccountInfo,
ASSOCIATED_TOKEN_PROGRAM_ID,
Token,
TOKEN_PROGRAM_ID,
u64,
} from "@solana/spl-token";
import { Connection, PublicKey } from "@solana/web3.js";
import { BN } from "bn.js";
@kayandra
kayandra / remove-meta-wordpress.php
Created June 24, 2021 18:37 — forked from nbeers22/remove-meta-wordpress.php
Remove all the extra bloat of meta tags that WordPress adds to the <head> and disables the JSON API
<?php
// remove some meta tags from WordPress
remove_action('wp_head', 'wp_generator');
function remove_dns_prefetch( $hints, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
return array_diff( wp_dependencies_unique_hosts(), $hints );
}
return $hints;
}
@kayandra
kayandra / _bem-builder.scss
Created September 13, 2019 23:05 — forked from iamravenous/_bem-builder.scss
Sass BEM Mixins
@mixin element($name) {
@at-root #{&}__#{$name}{
@content;
}
}
@mixin modifier($name) {
@at-root #{&}--#{$name} {
@content;
}
@kayandra
kayandra / bem.less
Created September 13, 2019 23:04 — forked from apertureless/bem.less
BEM Helper (SCSS, SASS, LESS, Stylus)
// Mixins
.has(@element; @content) {
&__@{element} {
@content();
}
}
.variant(@modifier; @content) {
&--@{modifier} {
@content();
@kayandra
kayandra / generate-ssh-key.sh
Created June 27, 2019 11:05 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa