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 | |
| MY_NETWORK="192.168.2.0/24" | |
| # Replace the ip address here with the ip address for your computer. You can use the programs "/sbin/ifconfig", or "/sbin/ip addr show". | |
| MY_HOST="192.168.2.20" | |
| # Network interfaces | |
| IN=enp0s3 | |
| OUT=enp0s3 |
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
| #!/usr/bin/env bash | |
| # $1 (first argument) should be the directory you want to transfer | |
| set -e | |
| tmp_file="tmp-file" | |
| folder="" | |
| path="" | |
| [[ -e $tmp_file ]] && rm $tmp_file | |
| [[ -d $1 ]] && path=$1 && folder=$(echo $path | rev | cut -d '/' -f 2 | rev) && echo "mkdir $folder" >>$tmp_file |
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
| /********************************************************* -- SOURCE -{{{1- */ | |
| /** Translate host name into IPv4 | |
| * | |
| * Resolve IPv4 address for a given host name. The host name is specified as | |
| * the first command line argument to the program. | |
| * | |
| * Build program: | |
| * $ gcc -Wall -g -o resolve <file>.cpp | |
| */ | |
| #include <stdio.h> |
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
| gcpr() { | |
| if ! git remote show origin -n &>/dev/null; then | |
| echo Not a repo m8 | |
| return 1 | |
| fi | |
| open "https://github.com/$(git remote show origin -n | grep "Fetch URL:" | cut -d : -f 3 | cut -d . -f 1)/pull/new/$(git rev-parse --abbrev-ref HEAD)" | |
| } |
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
| awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' ca.pem |
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
| #!/usr/bin/env bash | |
| set -e | |
| sudo apt-get update | |
| sudo apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common | |
| curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | |
| sudo apt-get update | |
| sudo apt-get -y install docker-ce docker-ce-cli containerd.io |
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
| #!/usr/bin/env bash | |
| cd -- "$(dirname "BASH_SOURCE")" | |
| set -e | |
| # latest commit | |
| LATEST_COMMIT=$(git rev-parse HEAD) | |
| pwd | |
| # latest commit where path/to/folder1 was changed | |
| FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff $1) |
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
| function frequency(array) { | |
| if (!array) throw new Error('input is not defined') | |
| else if (typeof array !== 'object') throw new Error('input is not an array') | |
| else if (!array.length) return [] | |
| const reducedArray = array.reduce((accumulator, current) => { | |
| accumulator[current] = accumulator[current] !== undefined ? accumulator[current] + 1 : 1 | |
| return accumulator | |
| }, {}) |