Skip to content

Instantly share code, notes, and snippets.

View vicradon's full-sized avatar
:bowtie:
building telex

Osinachi Chukwujama vicradon

:bowtie:
building telex
View GitHub Profile
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
'''
while right pointer > left pointer
- check through from the right pointer
- move cursor to the left if the number there equals target
- else check through from the left pointer
- if number equals target, swap the left with the right
- move the left forward
@vicradon
vicradon / check-sorted-disk-usage-with-dotfiles.sh
Last active October 22, 2024 17:44
Check the sorted disk usage of a particular directory on UNIX
sudo du -cksh .[!.]* * | sort -hr
@vicradon
vicradon / download-images-and-replace-remote-urls.py
Created May 2, 2024 16:02
Download images and replace the previous remote URL with local URL
import requests
import os
from urllib.parse import urlparse
import re
def process_markdown(markdown_file):
"""
Analyzes a markdown file, downloads images (current folder), and replaces URLs.
Args:
@vicradon
vicradon / Setting-the-azure-subscription-for-an-azure-cli-session.md
Created March 28, 2024 11:47
How to list and set the current active subscription in an Azure CLI shell

Listing subscriptions

For an account, you can list the available subscriptions using the command below:

az account subscription list --output table

It should output something like:

@vicradon
vicradon / ansible-guide.md
Created March 28, 2024 11:18
A guide on using Ansible for for IT automation and configuration management

An Ansible Guide

Ansible is an IaC tool that can help in provision infrastructure in virtual machines and update software in these machines.

@vicradon
vicradon / Setting up an ssh config.md
Created March 28, 2024 10:42
This gist explains the process of setting up and SSH config file that makes it easier for you to connect to remote hosts

Getting started

SSH is an integral part of a software engineer's day to day activity. You can use SSH commands to connect to a remotely hosted machine over the internet or a local network. The normal way to connect to a machine is using this syntax:

ssh -i identityfile.pem username@hostname 

You could also use a password. There's always a hassle to type this complete command, so you might want to abstract it to an alias in your ~/.bashrc or ~/.bash_profile file like this:

@vicradon
vicradon / 00-things-leading-to-nowhere.md
Last active May 21, 2024 03:14
A collection of trash writing that I don't know where it's leading to

Things Leading to Nowhere

This is a collection of things leading to nowhere

@vicradon
vicradon / create-unix-socket-server.py
Created February 11, 2024 04:11
This script allows you to open a socket connection on port 80 on a unix machine. It requires elevated privileges to run.
import socket
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(('localhost', 80))
server_socket.listen(1)
print('Server listening on port 80...')
@vicradon
vicradon / productivity-tools.md
Created February 9, 2024 07:27
All my productivity tools in one place