Skip to content

Commit

Permalink
2024-08-27 17:11:39.834227 new snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardocerqueira committed Aug 27, 2024
1 parent 50b08db commit 43f589a
Show file tree
Hide file tree
Showing 21 changed files with 1,258 additions and 0 deletions.
31 changes: 31 additions & 0 deletions seeker/report.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
--------------------------------------------------------------------------------
2024-08-27 17:11:39.834227
--------------------------------------------------------------------------------
On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
(use "git add <file>..." to include in what will be committed)
snippet/3proxy.sh
snippet/Merge Cells in Word using Python.py
snippet/Welcome-to-bulkOS.sh
snippet/airwork_test.py
snippet/airwrk.py
snippet/alpine-container.sh
snippet/arch-container.sh
snippet/asdf.py
snippet/bill_req_patient.go
snippet/code.py
snippet/git checkout-all-branches.sh
snippet/install.sh
snippet/neovim.sh
snippet/pomo.py
snippet/sharepoint_connection.py
snippet/slotVerse1withgui.py
snippet/slotVerse2nogui.py
snippet/ssacli_to_json.py
snippet/thirty_seven.java
snippet/ubuntu-container.sh

nothing added to commit but untracked files present (use "git add" to track)

--------------------------------------------------------------------------------
2024-08-26 17:12:12.080171
--------------------------------------------------------------------------------
Expand Down
144 changes: 144 additions & 0 deletions seeker/snippet/3proxy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#date: 2024-08-27T17:07:26Z
#url: https://api.github.com/gists/bd0eb83b0ac018f200299aa140fbff55
#owner: https://api.github.com/users/tuwibu

#!/bin/sh
random() {
tr </dev/urandom -dc A-Za-z0-9 | head -c5
echo
}

array=(1 2 3 4 5 6 7 8 9 0 a b c d e f)
gen64() {
ip64() {
echo "${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}"
}
echo "$1:$(ip64):$(ip64):$(ip64):$(ip64)"
}
install_3proxy() {
version=0.8.9
apt-get update && apt-get -y upgrade
apt-get install gcc make git -y
wget --no-check-certificate -O 3proxy-${version}.tar.gz https://raw.githubusercontent.com/Thanhan0901/install-proxy-v6/main/3proxy-${version}.tar.gz
tar xzf 3proxy-${version}.tar.gz
cd 3proxy-${version}
make -f Makefile.Linux
cd src
mkdir /etc/3proxy/
mv 3proxy /etc/3proxy/
cd /etc/3proxy/
wget --no-check-certificate https://github.com/SnoyIatk/3proxy/raw/master/3proxy.cfg
chmod 600 /etc/3proxy/3proxy.cfg
mkdir /var/log/3proxy/
cd /etc/init.d/
wget --no-check-certificate https://raw.github.com/SnoyIatk/3proxy/master/3proxy
chmod +x /etc/init.d/3proxy
update-rc.d 3proxy defaults
cd $WORKDIR
}

gen_3proxy() {
cat <<EOF
daemon
maxconn 1000
nscache 65536
timeouts 1 5 30 60 180 1800 15 60
setgid 65535
setuid 65535
flush
auth strong
users $(awk -F "/" 'BEGIN{ORS="";} {print $1 ":CL:" $2 " "}' ${WORKDATA})
$(awk -F "/" '{print "auth strong\n" \
"allow " $1 "\n" \
"proxy -6 -n -a -p" $4 " -i" $3 " -e"$5"\n" \
"flush\n"}' ${WORKDATA})
EOF
}

gen_proxy_file_for_user() {
cat >proxy.txt <<EOF
$(awk -F "/" '{print $3 ":" $4 ":" $1 ":" $2 }' ${WORKDATA})
EOF
}

upload_proxy() {
local PASS=$(random)
zip --password $PASS proxy.zip proxy.txt
URL=$(curl -s --upload-file proxy.zip https://transfer.sh/proxy.zip)

echo "Proxy is ready! Format IP:PORT:LOGIN:PASS"
echo "Download zip archive from: ${URL}"
echo "Password: "**********"
}
install_jq() {
wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x ./jq
cp jq /usr/bin
}
upload_2file() {
local PASS=$(random)
zip --password $PASS proxy.zip proxy.txt
JSON=$(curl -F "[email protected]" https://file.io)
URL=$(echo "$JSON" | jq --raw-output '.link')
echo "Proxy is ready! Format IP:PORT:LOGIN:PASS"
echo "Download zip archive from: ${URL}"
echo "Password: "**********"
}
gen_data() {
seq $FIRST_PORT $LAST_PORT | while read port; do
echo "usr$(random)/pass$(random)/$IP4/$port/$(gen64 $IP6)"
done
}

gen_iptables() {
cat <<EOF
$(awk -F "/" '{print "iptables -I INPUT -p tcp --dport " $4 " -m state --state NEW -j ACCEPT"}' ${WORKDATA})
EOF
}

gen_ifconfig() {
cat <<EOF
$(awk -F "/" '{print "/sbin/ip -6 addr add dev enp1s0 " $5 }' ${WORKDATA})
EOF
}



echo "installing apps"

install_3proxy

echo "working folder = /home/proxy-installer"
WORKDIR="/home/proxy-installer"
WORKDATA="${WORKDIR}/data.txt"
mkdir $WORKDIR && cd $_

IP4=$(curl -4 -s icanhazip.com)
IP6=$(curl -6 -s icanhazip.com | cut -f1-4 -d':')

echo "Internal ip = ${IP4}. Exteranl sub for ip6 = ${IP6}"

echo "How many proxy do you want to create? Example 500"
read COUNT

FIRST_PORT=10000
LAST_PORT=$(($FIRST_PORT + $COUNT))

gen_data >$WORKDIR/data.txt
gen_iptables >$WORKDIR/boot_iptables.sh
gen_ifconfig >$WORKDIR/boot_ifconfig.sh
chmod +x ${WORKDIR}/boot_*.sh /etc/rc0.d

gen_3proxy >/etc/3proxy/3proxy.cfg
ulimit -S -n 4096
/etc/init.d/3proxy start

gen_proxy_file_for_user

#upload_proxy
install_jq && upload_2file
51 changes: 51 additions & 0 deletions seeker/snippet/Merge Cells in Word using Python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#date: 2024-08-27T16:59:28Z
#url: https://api.github.com/gists/7f7b7249869b6a11fbba48c57cff19e1
#owner: https://api.github.com/users/aspose-com-kb

import aspose.words as aw
import aspose.pydrawing as drawing

def mergeCells(startCell: aw.tables.Cell, endCell: aw.tables.Cell):

parentTable = startCell.parent_row.parent_table

# Find the start and end cell position
startCellPos = drawing.Point(startCell.parent_row.index_of(startCell), parentTable.index_of(startCell.parent_row))
endCellPos = drawing.Point(endCell.parent_row.index_of(endCell), parentTable.index_of(endCell.parent_row))

# Create a range of cells
mergeRange = drawing.Rectangle(
min(startCellPos.x, endCellPos.x),
min(startCellPos.y, endCellPos.y),
abs(endCellPos.x - startCellPos.x) + 1,
abs(endCellPos.y - startCellPos.y) + 1)

for row in parentTable.rows:
row = row.as_row()
for cell in row.cells:
cell = cell.as_cell()
currentPos = drawing.Point(row.index_of(cell), parentTable.index_of(row))

# Merge the cell if inside the range
if mergeRange.contains(currentPos):
cell.cell_format.horizontal_merge = aw.tables.CellMerge.FIRST if currentPos.x == mergeRange.x else aw.tables.CellMerge.PREVIOUS
cell.cell_format.vertical_merge = aw.tables.CellMerge.FIRST if currentPos.y == mergeRange.y else aw.tables.CellMerge.PREVIOUS

# Load the license
wordLic = aw.License()
wordLic.set_license("license.lic")

tableDoc = aw.Document("Table.docx")

table = tableDoc.first_section.body.tables[0]

# Define start and end cell for the range
cellStartRange = table.rows[0].cells[0]
cellEndRange = table.rows[1].cells[1]

# Merge cells
mergeCells(cellStartRange, cellEndRange)

tableDoc.save("output.docx")

print ("Table cells merged successfully")
10 changes: 10 additions & 0 deletions seeker/snippet/Welcome-to-bulkOS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#date: 2024-08-27T17:05:27Z
#url: https://api.github.com/gists/e4b4992a3ea35e5fe5edb687c82b906e
#owner: https://api.github.com/users/rmassaroni

echo " ________ __ __ __ __ __ _______ _______ "
echo "| | | |.-----.| |.----.-----.--------.-----. | |_.-----. | |--.--.--.| | |--.| | __|"
echo "| | | || -__|| || __| _ | | -__| | _| _ | | _ | | || | < | - |__ |"
echo "|________||_____||__||____|_____|__|__|__|_____| |____|_____| |_____|_____||__|__|__||_______|_______|"
echo -n "by RJM---------------------------------------------------------------------------------------" ; echo "$(date "+%a %b %d %Y")"
echo
91 changes: 91 additions & 0 deletions seeker/snippet/airwork_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#date: 2024-08-27T16:45:31Z
#url: https://api.github.com/gists/373dd8d79f9319eccd04c979cf2a9396
#owner: https://api.github.com/users/nahid111

from typing import List

"""
Problem 1: Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
Example 1:
Input: num = 38
Output: 2
Explanation: The process is as follows: 3 + 8 = 11, then 1 + 1 = 2. Since 2 has only one digit, 2 is returned.
"""


def add_digits(num: int) -> int:
if num == 0:
return num

num = str(num)

if len(num) == 1:
return int(num)

res = 0
for n in num:
res += int(n)

return add_digits(res)


"""
Problem 2: Contains Duplicate
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Example 1:
Input: nums = [1,2,3,1]
Output: true
Explanation: The value 1 appears twice in the array.
"""


def contains_duplicate(nums: List[int]) -> bool:
if not nums:
return False

cache_ = {}

for i in nums:
if i in cache_:
return True
else:
cache_[i] = 1

return False


"""
Problem 3: Reverse Vowels of a String
Write a function that takes a string as input and reverses only the vowels of a string.
Example 1:
Input: s = "algorithm"
Output: "ilgorathm"
Explanation: The vowels "e" and "o" are reversed.
"""


def reverse_vowels(word: str):
if word == "":
return ""

word = list(word)
vowels = ['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U']
left, right = 0, len(word)-1

while left < right:
if word[left] in vowels:
for c in range(right, left, -1):
if word[c] in vowels:
word[left], word[c] = word[c], word[left]
right = c-1
break
left += 1
return "".join(word)

50 changes: 50 additions & 0 deletions seeker/snippet/airwrk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#date: 2024-08-27T16:59:54Z
#url: https://api.github.com/gists/aa376db8b841b1d90d9e0c56f6509272
#owner: https://api.github.com/users/ahmadalsajid

# Problem 1
def div_sum(n):
return sum([int(i) for i in list(str(n))])

def solution1(num):
while num > 9:
num = div_sum(num)
print(num)

solution1(num = 38)


# Problem 2
def solution2(nums):
_set = set(nums)
if len(_set) == len(nums):
print('false')
else:
print('true')

solution2(nums = [1,1,1,3,3,4,3,2,4,2])


# Problem 3
def solution3(s):
vowels = 'aeiouAEIOU'
_temp_vowels = list()
_temp_string = list()

for letter in s:
if letter in vowels:
_temp_vowels.append(letter)
_temp_string.append('_')
else:
_temp_string.append(letter)

_temp_vowels.reverse()
_index = 0
for _indx, letter in enumerate(_temp_string):
if letter == '_':
_temp_string[_indx] = _temp_vowels[_index]
_index = _index + 1

print(''.join(_temp_string))

solution3(s = 'algorithm')
Loading

0 comments on commit 43f589a

Please sign in to comment.