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
while IFS= read -r line; do | |
if [[ $line =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[[:space:]] ]]; then | |
ip=$(echo "$line" | awk '{print $1}') | |
if [[ $ip =~ ^192\. ]]; then | |
echo "$line" | |
fi | |
else | |
echo "$line" | |
fi | |
done < ~/.ssh/known_hosts > ~/.ssh/known_hosts.new && mv ~/.ssh/known_hosts.new ~/.ssh/known_hosts |
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 | |
wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh -P /tmp | |
bash /tmp/Anaconda3-2023.09-0-Linux-x86_64.sh -b | |
/root/anaconda3/bin/conda init --all | |
/root/anaconda3/bin/conda update -n base -y -c defaults conda | |
source /root/.bashrc | |
/root/anaconda3/bin/conda install -y python=3.10 | |
/root/anaconda3/bin/conda install -y pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia |
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
import argparse | |
import heapq | |
def merge_log_files(input_files, output_file): | |
with open(output_file, 'w') as out_file: | |
for line in heapq.merge(*(open(f,'r') for f in input_files)): | |
current_block = [] | |
if line.startswith("\t"): | |
current_block.append(line) |
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 python3 | |
# Create a script that will check if the certificate matches the hostname of the server | |
# and if the certificate is valid | |
import socket | |
import ssl | |
import time | |
def check_dns_record(hostname, port): |
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 mkcd() { | |
# Check if the directory already exists | |
if [ -d "$1" ]; then | |
# If the directory already exists, print an error message | |
printf "Error: directory '%s' already exists\n" "$1" | |
else | |
# If the directory does not already exist, create it | |
mkdir "$1" | |
# Check if the directory was successfully created |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"sort" | |
"time" | |
) | |
func createDeck() *[52]int { |
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
mysql -h$MYSQL_HOSTNAME -u$MYSQL_USERNAME -p$MYSQL_PASSWORD < file.sql |
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
import multiprocessing | |
def func(x): | |
print(x*x) | |
num_of_workers = multiprocessing.cpu_count() | |
pool = multiprocessing.Pool(num_of_workers) | |
for i in range(1,10): | |
pool.apply_async(func, args=(i,)) |
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
// ==UserScript== | |
// @name Auto Click Through AWS SAML | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Cause laziness runs the world. | |
// @author aacala | |
// @match https://signin.aws.amazon.com/saml | |
// @grant none | |
// @require http://code.jquery.com/jquery-3.3.1.min.js | |
// ==/UserScript== |