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 https://github.com/docker-library/golang/blob/ee2d52a7ad3e077af02313cd4cd87fd39837412c/1.15/alpine3.12/Dockerfile | |
#custom | |
rm -rf /usr/local/go/src/* | |
apk add build-base | |
apk add gnupg go bash | |
apk add --no-cache \ | |
ca-certificates | |
# set up nsswitch.conf for Go's "netgo" implementation |
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
wsl -u root ip addr add 192.168.1.225/24 broadcast 192.168.1.255 dev eth0 label eth0:1 | |
netsh interface ip add address "vEthernet (WSL)" 192.168.1.220 255.255.255.0 |
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
#Elevated Shell | |
param([switch]$Elevated) | |
function Check-Admin { | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
if ((Check-Admin) -eq $false) { | |
if ($elevated) { | |
# could not elevate, quit | |
} else { |
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
# install packages | |
sudo apt-get update | |
sudo apt-get install nload htop -y | |
# if your user doesn't exists then remove sudo passwords | |
USERNAME=$(whoami) | |
sudo grep -qxF "${USERNAME} ALL=(ALL) NOPASSWD: ALL" /etc/sudoers || echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers | |
# install reqs docker | |
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
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
# change to root and install packages | |
su -c "apk add sudo openrc curl python3 python3-dev nload htop" | |
# if your user doesn't exists then remove sudo passwords | |
USERNAME=$(whoami) | |
su -c "grep -qxF '${USERNAME} ALL=(ALL) NOPASSWD: ALL' /etc/sudoers || echo '${USERNAME} ALL=(ALL) NOPASSWD: ALL' | tee -a /etc/sudoers" | |
# install compilers | |
sudo apk add build-base | |
# install pip3 | |
sudo apk add py3-pip | |
# upgrade pip3 |
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
BASE=docker | |
# modify these in /etc/default/$BASE (/etc/default/docker) | |
DOCKERD=/usr/bin/dockerd | |
# This is the pid file managed by docker itself | |
DOCKER_PIDFILE=/var/run/$BASE.pid | |
# This is the pid file created/managed by start-stop-daemon | |
DOCKER_SSD_PIDFILE=/var/run/$BASE-ssd.pid | |
DOCKER_LOGFILE=/var/log/$BASE.log | |
DOCKER_OPTS= |
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 flask import Flask, request, redirect, url_for, make_response, abort | |
from werkzeug import secure_filename | |
from pymongo import Connection | |
from pymongo.objectid import ObjectId | |
from gridfs import GridFS | |
from gridfs.errors import NoFile | |
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) | |
DB = Connection().gridfs_server_test | |
FS = GridFS(DB) |
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 pymysql | |
# Connect to the database | |
connection = pymysql.connect(host=$IP_SERVIDOR, | |
user=$USUARIO, | |
password=$CONTRASEÑA, | |
db=$BASE_DATOS, | |
charset='utf8mb4', | |
) | |
try: |
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 python | |
# Tiny Syslog Server in Python. | |
## | |
# This is a tiny syslog server that is able to receive UDP based syslog | |
# entries on a specified port and save them to a file. | |
# That's it... it does nothing else... | |
# There are a few configuration parameters. | |
# create a ramdisk if you want to use stoe logs on the ram disk. (faster thant |
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 sys | |
import logging | |
import logging.config | |
import random | |
import string | |
# "thank you" to folks on StackOverflow.com for various ideas, | |
# for this example. Works with Python3. |
NewerOlder