Skip to content

Instantly share code, notes, and snippets.

View vicradon's full-sized avatar
🥑
creating technical content

Osinachi Chukwujama vicradon

🥑
creating technical content
View GitHub Profile
@vicradon
vicradon / copy-to-clipboard-macos.m
Last active September 12, 2024 09:01 — forked from mwender/impbcopy.m
Command line copy an image file to the clipboard in Mac OS X. See first comment for install instructions.
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
if([path isEqualToString:@"-"])
{
// http://caiustheory.com/read-standard-input-using-objective-c
@vicradon
vicradon / bulk-invite-guest-user-powershell-azure.ps1
Created September 7, 2024 06:09
Bulk invite guest users azure powershell
$invitations = import-csv c:\bulkinvite\invitations.csv
$messageInfo = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphInvitation]@{ CustomizedMessageBody = "Hello. You are invited to the Contoso organization." }
foreach ($email in $invitations)
{New-MgInvitation -InviteRedirectUrl https://portal.azure.com -InvitedUserDisplayName $email.Name -InvitedUserEmailAddress $email.InvitedUserEmailAddress -InvitedUserMessageInfo $messageInfo -SendInvitationMessage
}
@vicradon
vicradon / download-and-extract-node.js
Last active August 30, 2024 07:50
Download and extract Node.js
#!/bin/bash
sudo apt install wget xz-utils -y
# download and extract node.js
wget https://nodejs.org/dist/v20.17.0/node-v20.17.0-linux-x64.tar.xz
tar -xf node-v20.17.0-linux-x64.tar.xz
cd node-v20.17.0-linux-x64
sudo cp bin/* /usr/local/bin
@vicradon
vicradon / install-go.sh
Created July 18, 2024 16:43
Install Go
#!/bin/bash
cd ~
wget https://go.dev/dl/go1.22.5.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.5.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
@vicradon
vicradon / force-overwrite.sh
Created July 1, 2024 03:51
Force overwrite packages when I got this error "The following packages have unmet dependencies: libgdal30 : Depends: libodbcinst2 (>= 2.3.1) but it is not going to be installed"
sudo apt install -o DPkg::Options::="--force-overwrite" libodbcinst2 unixodbc-common
@vicradon
vicradon / use-vscode-on-browser-from-vm.md
Last active June 18, 2024 15:11
Use VSCode on browser from VM

Use VSCode on browser from a virtual machine

You simply have to install vscode's code CLI on the virtual machine. Use this command:

curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz
tar -xf vscode_cli.tar.gz
cd vscode_cli
./code tunnel
@vicradon
vicradon / petstoreoai.json
Created June 14, 2024 14:05
Petstore OAI Spec
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Petstore",
"description": "The Petstore API but using Express.js",
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
@vicradon
vicradon / redirect-to-dev-null.sh
Created June 14, 2024 09:28
Redirect a command to /dev/null
command > /dev/null 2>&1
@vicradon
vicradon / remove-docker-images.md
Created June 14, 2024 07:44
Remove docker images

Remove all dangling images docker image prune -a

Remove all unused images, volumes, and networks

docker system prune --all

@vicradon
vicradon / how-nginx-works.md
Last active June 6, 2024 09:03
How does Nginx Work?

How Nginx Works

Nginx works using configuration files. You define a configuration for a single site or all the sites in a machine and Nginx serves the content of that defined site. In the past, folks defined new sites in the /etc/nginx/sites-available and /etc/nginx/sites-enabled directories. These days, Nginx suggests that you use the conf.d directory. The default Nginx config serves the default Nginx page, i.e. welcome to Nginx. But you can easily replace it with something simple that reverse proxies your requests. Something like this:

http {
    server {
        listen 80;

 location / {