Skip to content

Instantly share code, notes, and snippets.

View espinz's full-sized avatar

Francisco Espinoza espinz

  • USA
View GitHub Profile
@espinz
espinz / Hotdogs.sh
Created September 13, 2021 18:11
How many hotdogs for 26 contestants if each eat 2 after the first.
#!/bin/bash
HOTDOGS(){
for i in {1..26};do
a=$((i-1))
b=$((i+a))
let c+='b'
printf %s "$b "
done
}
@espinz
espinz / HelloWorld.java
Created July 29, 2021 08:14
Hello World
package com.Espinz;
public class HelloWorld {
public static void main(String[] args) {
System.out.print("Hello Worlds!");
}
}
@espinz
espinz / grub.md
Created November 10, 2019 02:10
Hyper-V screen resize for Linux guest vm

Change the screen resolution after Installing a Linux VM

sudo vim /etc/default/grub
# find and replace this line GRUB_CMDLINE_LINUX_DEFAULT
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1280x720"
sudo update-grub
sudo reboot
@espinz
espinz / Shapes.py
Created November 9, 2019 18:57
Classes Exercise
class Shapes:
"""A shapes class."""
def __init__(self):
self.question = input('What is your favorite type of shape? ')
self.triangle = "triangle"
self.square = "square"
self.circle = "circle"
def shape_type(self):
print('Your favorite shape is a', end=' ')
@espinz
espinz / ssh.md
Created November 2, 2019 18:37
ssh recipes

ssh

Recipes for the ssh command

local ssh config file

Use this file to setup remote host information

vi ~/.ssh/config
@espinz
espinz / vim.md
Last active November 2, 2019 11:26
vim recipes

vim

Recipes for the vim editor

split screen

This is perfect for viewing files side by side.

  • vim -O filename1 filename2

tab each file

@espinz
espinz / find.md
Last active November 2, 2019 11:11
BSD find recipes

Find

Recipes for the find command

Exclude directories

find . -type d ( -path ./directory1 -o -path ./directory2 ) -prune -o -iname "*.txt" -print -exec mv {} TXT ;

Delete all files in a git directory

find . -maxdepth 1 ! -name ".git" -exec rm -rf {} ;

@espinz
espinz / firecracker.sh
Last active October 29, 2019 07:17
Finding an explosion of files and moving them into a new folder
find . -type d \( -path ./directory1 -o -path ./directory2 \) -prune -o -iname "*.txt" -print -exec mv {} TXT \;
@espinz
espinz / Making Directories.sh
Last active September 26, 2019 16:43
creating directories from a list
cat Study.org| grep Chapter | head -n 9 > holder.txt && xargs -0 -n 1 mkdir < <(tr \\n \\0 <holder.txt) && rm holder.txt
@espinz
espinz / directories.sh
Created September 17, 2019 22:13
renaming directories
COUNT=$(ls | grep -E "Chapter\ [0-9]" | cut -d ' ' -f 3-10 | wc -l)
for x in `seq 0 $COUNT`; do
if [ "$x" -eq "0" ]; then
newDIRS=$(ls | grep -E "Chapter\ [0-9]" | cut -d ' ' -f 3-10 | head -n 1)
mkdir "$x. ${newDIRS}"
else
DIRS=$(ls | grep -E "Chapter\ [0-9]*" | sort -k2 -n | cut -d ' ' -f 3-10 | tail -n 15 | sed -n ${x}p)
newDIRS=$(ls | grep -E "Chapter\ [0-9]" | cut -d ' ' -f 3-10 | sed -n ${x}p)
mkdir "$x. ${DIRS}"