Skip to content

Instantly share code, notes, and snippets.

@alex700
alex700 / check_sum.rb
Created October 12, 2023 22:55
Checksum of Ruby Application
View check_sum.rb
#!/usr/bin/env ruby
require 'digest'
require 'fileutils'
# Function to calculate the checksum for a directory
def calculate_checksum(directory_path, excluded_directories = [])
checksum = Digest::SHA256.new
Dir[File.join(directory_path, '**', '**/*')].each do |file|
@alex700
alex700 / add_two_numbers.js
Created August 7, 2022 21:38
Add two numbers (LeetCode #2)
View add_two_numbers.js
function ListNode(val, next) {
this.val = (val === undefined ? 0 : val);
this.next = (next === undefined ? null : next);
}
const addTwoNumbers = (l1, l2) => {
let carry = 0;
let result = new ListNode(-1)
let dummy = result;
@alex700
alex700 / lru_cache.js
Created August 7, 2022 21:31
LRU Cache Implementation
View lru_cache.js
class LruCache {
constructor(capacity) {
this.capacity = capacity;
this.map = new Map();
}
get(key) {
if(this.map.has(key)) {
let val = this.map.get(key);
this.map.delete(key);
@alex700
alex700 / main.go
Created June 23, 2022 21:39
Detect Number of Islands - LeetCode - Go
View main.go
package main
import "fmt"
func main() {
var a = [][]int{
{0, 0, 1, 1, 0},
{0, 0, 1, 1, 0},
{1, 0, 1, 0, 0},
{1, 0, 1, 0, 0},
@alex700
alex700 / BluetoothOn
Created April 14, 2020 16:45
Perform these commands to solve the problem: Connection Failed: blueman.bluez.errors.DBusNotReadyError: Resource Not Ready
View BluetoothOn
bluetoothctl
power on
discoverable on
pairable on
scan on
@alex700
alex700 / ng_image_skin.sh
Last active November 19, 2019 19:16
KDE5 - Set National Geographic Picture of a Day to Desktop
View ng_image_skin.sh
#!/bin/bash
# This script downloads photo of the day from nationalgeographic.com and set it as desktop wallpaper.
# Applicable for Ubuntu KDE 18.04
# Permission to copy, modify, and distribute is granted under GPLv3
# Last Revised 7 Mar 2019
#
# Initial installation:
# Place the script into /usr/local/bin/ng_image_skin
# Run it to pull image and create symlink to it which will be lcocated at ~/Picture/Wallpapers/wp_image
# Set desktop image manually that pointed to ~/Picture/Wallpapers/wp_image
@alex700
alex700 / kernel_4.19.sh
Last active January 16, 2019 00:21
Download and install linux 4.19 kernel
View kernel_4.19.sh
#!/bin/bash
#
# Install linux kernel 4.19
#
# To check last available dep's visit https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/
#
##
rm -rf linux-*;
@alex700
alex700 / phpldapadmin.conf
Created October 11, 2018 21:33
Nginx Config for phpldapadmin
View phpldapadmin.conf
server {
listen 80;
server_name localhost;
# application: phpldapadmin
location /phpldapadmin {
alias /usr/share/phpldapadmin/htdocs;
index index.php index.html index.htm;