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
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
C:\ProgramData\chocolatey\bin\choco.exe install openssh | |
mkdir C:\ProgramData\ssh | |
cp 'C:\Program Files\OpenSSH-Win64\sshd_config_default' C:\ProgramData\ssh\sshd_config | |
cd "C:\Program Files" | |
.\OpenSSH-Win64\ssh-keygen.exe -f C:\ProgramData\ssh\ssh_host_dsa_key -t dsa | |
.\OpenSSH-Win64\ssh-keygen.exe -f C:\ProgramData\ssh\ssh_host_rsa_key -N '' -t rsa | |
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 | |
.\OpenSSH-Win64\sshd -D |
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
from json import loads | |
from requests import post | |
class TelegramBot: | |
def __init__(self, id_): | |
self.id = id_ | |
@staticmethod | |
def post_request(request): |
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
from pathlib import Path | |
from os import listdir | |
from torf import Torrent | |
trackers = [ | |
"udp://tracker.coppersurfer.tk:6969/announce", | |
"udp://tracker.leechers-paradise.org:6969/announce", | |
"udp://tracker.opentrackr.org:1337/announce", | |
"udp://tracker.internetwarriors.net:1337/announce", |
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
FROM golang:1.9 | |
# Install Jupyter Notebook | |
# `hash -r pip` is a workaround of pip v10 related issue (https://github.com/pypa/pip/issues/5221#issuecomment-382069604) | |
RUN apt-get update && apt-get install -y libzmq3-dev python3-pip && rm -rf /var/lib/apt/lists/* | |
RUN pip3 install --upgrade pip && hash -r pip && pip3 install -U jupyter jupyterlab && jupyter serverextension enable --py jupyterlab --sys-prefix | |
# Install lgo Jupyter lab extension to support code formatting. | |
# Please remove this line if you do not use JupyterLab. | |
RUN curl -sL https://deb.nodesource.com/setup_8.x | 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
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VMware/" | |
sudo /usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmmon) | |
sudo /usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmnet) | |
sudo mokutil --import MOK.der | |
reboot |
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
FROM ubuntu:19.10 as build-env | |
RUN sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get install wget -y \ | |
&& apt-get build-dep nmap -y | |
RUN wget https://nmap.org/dist/nmap-7.80.tar.bz2 \ | |
&& bzip2 -cd nmap-7.80.tar.bz2 | tar xvf - \ | |
&& cd nmap-7.80 \ | |
&& ./configure \ | |
&& make |
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 read_env() { | |
if builtin cd "$@"; then | |
local env="$PWD/.zenv" | |
if [ -f "$env" ]; then | |
if [ -z "$CURRENT_ENV" ]; then | |
builtin source "$env" | |
export CURRENT_ENV="$env" | |
elif [ ! "$CURRENT_ENV" = "$env" ]; then | |
if [ "$(type -t deactivate)" = "function" ]; then | |
deactivate |
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
$date = Get-Date -Format "yyyy-MM-dd_HH:mm:ss" | |
if (! $args ) { | |
$msg = $date | |
} else { | |
$msg = $args | |
} | |
git add . | |
git commit -m "$msg" |
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 | |
c=0 | |
for f in *.zip; do | |
x="$(zipinfo -t "$f" | awk '{print $1}')" | |
c=$(( $c + $x )) | |
done | |
echo "The total file count is:" $c |
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
from os import walk, path | |
def get_folder_size(start_path): | |
""""Output size of folder in bytes""" | |
total_size = 0 | |
for dir_path, dir_names, file_names in walk(start_path): | |
for f in file_names: | |
fp = path.join(dir_path, f) | |
# skip if it is symbolic link | |
if not path.islink(fp): |