Skip to content

Instantly share code, notes, and snippets.

View 11philip22's full-sized avatar
👽
planet rider

Philip 11philip22

👽
planet rider
  • /dev/chaos
View GitHub Profile
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 - && \
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
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
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
@11philip22
11philip22 / autogit.ps1
Created February 20, 2020 09:52
git for lazy people
$date = Get-Date -Format "yyyy-MM-dd_HH:mm:ss"
if (! $args ) {
$msg = $date
} else {
$msg = $args
}
git add .
git commit -m "$msg"
#!/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
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):
---
- hosts: all
remote_user: root
tasks:
- name: Update the apt package index
become: yes
apt:
name: "*"
state: latest
from sys import argv
from json import dump
file = argv[1]
url_list = []
with open(file) as f:
for line in f:
url_list.append(line.strip("\n"))
@11philip22
11philip22 / Jenkinsfile
Last active May 12, 2020 00:04
Jenkinsfile for building docker containers
String dockerHubUser = "philipwold"
String repo = "mpd"
node ("master") {
try {
stage ("checkout scm") {
checkout scm
}
stage ("run dos2unix") {