#!/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
""" | |
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
# .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
#!/usr/bin/env bash | |
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
rsync -arv \ | |
--exclude-from=$CWD/exclude.txt \ | |
$CWD \ | |
vpn:~/ |
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
from pyspark.sql import SparkSession | |
# config | |
INPUT = "" | |
OUTPUT = "" | |
def main(): | |
spark = ( SparkSession.builder | |
.appName("Viet PySpark") | |
.config("spark.dynamicAllocation.enabled","true") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// read file by line | |
file, err := os.Open("file.txt") | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer file.Close() | |
scan := bufio.NewScanner(file) | |
for scan.Scan() { | |
line := scan.Text() |
NewerOlder