This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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-*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bluetoothctl | |
power on | |
discoverable on | |
pairable on | |
scan on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name localhost; | |
# application: phpldapadmin | |
location /phpldapadmin { | |
alias /usr/share/phpldapadmin/htdocs; | |
index index.php index.html index.htm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open rails console `rails c` and run the command: | |
ActiveRecord::Base.descendants.map(&:name).each { |name| puts name } | |
# Alternatively, list classes that extend ActiveRecord::Base or any other class the application might use as a base model | |
ObjectSpace.each_object(Class).select { |klass| klass < ActiveRecord::Base }.map(&:name).sort | |
# For docker-based apps | |
docker exec -it [your_container_name] rails runner "ActiveRecord::Base.descendants.each { |model| puts model.name }" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage Instructions | |
# - Open Opal and login to AWS. | |
# - Copy content with environment variables and place it to ~/.aws/opal-config.txt | |
# - Make the script executable: chmod +x update-config.sh | |
# - The script will place the credentials to ~/.aws/config | |
config_file="$HOME/.aws/opal-config.txt" | |
aws_config_file="$HOME/.aws/config" |