This file contains hidden or 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/ruby | |
require 'pry-byebug' | |
history_array = [] | |
zsh_history_path = '~/.zhistory' | |
File.open(zsh_history_path).each do |line| | |
history_array << line[15..-2] | |
end |
This file contains hidden or 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
params = ActionController::Parameters.new( {sort: {year: 'desc', title: 'asc', author: 'desc'}} ) | |
valid_sorts = ["author", "title", "year"] | |
passed_sorts = params[:sort].keys & valid_sorts # only permit valid sorts | |
params.permit(sort: passed_sorts) |
This file contains hidden or 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 Oracle Java JRE (runtime environment) on Fedora | |
# This is script is based on Fedy | |
# To change between java versions: | |
# $ alternatives --config java | |
CACHEDIR="/var/cache/java/jre" |
This file contains hidden or 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 | |
docker run -it --security-opt seccomp:unconfined docker_image bash |
This file contains hidden or 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
# using Fedora | |
# every time you update the Linux Kernel you have to recompile the VirtualBox Kernel driver | |
# first install/upgrade the kernel-devel and headers | |
sudo dnf install kernel-devel kernel-headers | |
# make sure you have installed akmod-VirtualBox (and DON'T have installed dkms) | |
sudo dnf install akmod-VirtualBox | |
sudo akmods | |
sudo modprobe vboxdrv |
This file contains hidden or 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
# ----> Ruby File: hi.rb | |
# Importing code from Python to Ruby | |
p obj = eval(`python hi.py`.chomp) | |
# Exporting code from Ruby to Python | |
p my_array = [[1,2,3],["hi", 1.5]] | |
# Executing Python code 'inside' Ruby passing args from ruby variables to python | |
p obj = eval(`python hi.py '#{my_array}'`.chomp) |
This file contains hidden or 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
# install ipdb with pip | |
import ipdb | |
# place the following command where you want to stop | |
ipdb.set_trace(context=10) |
This file contains hidden or 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
sudo chsh -s `which zsh` <username> | |
# You must log out and log back in. |
This file contains hidden or 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 | |
# How to change the Docker images directory (default dir=/var/lib/docker) | |
# The simplest method is to create a symbolic link that maps your destination partition and the original docker images directory | |
# see REF: https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169 | |
# remove all containers | |
docker ps -aq | xargs docker rm | |
# stop docker daemon | |
systemctl stop docker |