#!/usr/bin/env bash
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
This file contains 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
# 1. python file | |
sudo mkdir -p /opt/cred | |
cat <<ETO > /opt/cred/creds.py | |
import argparse | |
import sys | |
import yaml | |
parser = argparse.ArgumentParser(description='find creds or execute credential') | |
parser.add_argument('--mode', help='mode to run') | |
parser.add_argument('--name', help='name to find') |
This file contains 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" | |
"sync" | |
"time" | |
) | |
const concurrency = 3 | |
const numTasks = 100 |
This file contains 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
""" | |
simple example showing sqlalchemy Adjacency List Relationships | |
https://docs.sqlalchemy.org/en/13/orm/self_referential.html | |
""" | |
from sqlalchemy import create_engine, Column, ForeignKey, Integer, String | |
from sqlalchemy.orm import sessionmaker, relationship, backref | |
from sqlalchemy.ext.declarative import declarative_base | |
DB_PATH = 'sqlite:///nodes.sql' |
This file contains 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
"""script for downloading album from chiasenhac | |
""" | |
import time | |
import sys | |
from pathlib import Path | |
from bs4 import BeautifulSoup | |
import requests | |
from multiprocessing import Pool | |
BASE_OUTPUT = 'albums' |
This file contains 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
# .zip | |
zip -r -o out.zip folder | |
unzip out.zip | |
# xz | |
gzip -r folder | |
gzip -f file | |
gunzip out.gz | |
# tar.gz |
This file contains 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
# list | |
vboxmanage list vms | |
vboxmanage list runningvms | |
# start | |
VM=cent7_1 | |
vboxmanage startvm $VM --type headless | |
# stop | |
vboxmanage controlvm Ubuntu poweroff soft |
This file contains 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
# -*- coding: utf-8 -*- | |
import h5py | |
import sys | |
import pandas as pd | |
import datetime | |
if len(sys.argv) == 1: | |
print("No provided file") | |
sys.exit(1) |
This file contains 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
# settings.py | |
EMAIL_BACKEND = 'backends.SMTPEmailBackend' | |
# backends.py | |
"""Custom SMTP email backend class""" | |
import smtplib | |
from django.core.mail.utils import DNS_NAME | |
from django.core.mail.backends.smtp import EmailBackend | |
class SMTPEmailBackend(EmailBackend): |
This file contains 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 os | |
import sys | |
import pandas as pd | |
import numpy as np | |
import matplotlib | |
from matplotlib import pyplot as plt | |
import seaborn as sns | |
from IPython.core.display import display, HTML |
NewerOlder