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
# on the remote server you want to use to send a file, you run: | |
# curl -F "file=@/log.txt" http://100.100.100.100:8000/ | |
# this will create the file log.txt in /tmp that will ideally containt he log.txt from the remote machine | |
from http.server import SimpleHTTPRequestHandler | |
import os | |
class FileUploadHandler(SimpleHTTPRequestHandler): | |
def do_POST(self): | |
content_length = int(self.headers['Content-Length']) |
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 | |
# This script looks for the first argument to be in single quotes and relative to the base (and obviously a ccsecure file!) | |
# CipherCloud is annoying, but not hard. Lets manipulate this to extract! | |
open /Applications/CipherCloud.app "$1" | |
# Lets find the parent directory for each file, to place the extracted file after done | |
parentdir="$(dirname "$1")" |
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
find . -name *.mp4 -exec md5sum '{}' ';' | while read sum file ; do cp "$file" /mnt/tmp-move/"$sum".mp4 ; done |
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
apiVersion: v1 | |
clusters: | |
- cluster: | |
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFNU1UQXlOREl4TURVd05Gb1hEVEk1TVRBeU1USXhNRFV3TkZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBT3hZCnlxdEdseklVd2lYWVBKTGh4MFhsdnNtRUVYS1Zwa3NZMS9ESWdZdUFYWjRBeXk3KzAzcUVmOElUa3BSRVI3ZnQKbEt4cXZ6dmsvd3Mwc2R3UlZRcEhjUUttYUo3Z3l2ZWh4Zkg2Z1lCbWR5TW4rZ0Nwczh1Z3ZSUGNsZi9zc3NDZwo2TmJncUJxQTRVNklQeW9oSWo2T0EwV2FPb01ZRk1XM0FjZ3g0N05tb21HYm9BMG5pRk5vWW43VkNJYTh6U2I5CkdwNTJXb3JXZitCMi9TZm9LQVIzVEhyeWNrK0IzMmVDWkExSDV6bGN4MENrNE1LeXpNS0VKUDR3dEplZkRRNVcKMGhUUSthWEVJMmJwRnBmT3JiSThCTW1vZjladktVTzRkR0NHTEd1MFBXcEFNc0MydnV1K0piOW1lVHhXQkpsSQphRVNRQjFtUTN2MURHZ2Q4ZmtFQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFLYXNzK0NYbUVZdEM4dXh6cEFvRG56Tjh5NTAKcUt4RDlHaVFNRU0vRXJhVFp0My9aY3JncURUQlNUUURoN2J1TlRi |
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 zipfile | |
from pathlib import Path | |
# Pathlib Friendly (maybe required) | |
def extract(filename): | |
z = zipfile.ZipFile(filename) | |
for file in z.namelist(): | |
# Ignore anything that's not a zip... and lets recurse | |
if ".zip" in file.lower(): | |
# Create a subdirectory to hold our zip: |
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
# This will use osd.5 as an example | |
# ceph commands are expected to be run in the rook-toolbox | |
1) disk fails | |
2) remove disk from node | |
3) mark out osd. `ceph osd out osd.5` | |
4) remove from crush map. `ceph osd crush remove osd.5` | |
5) delete caps. `ceph auth del osd.5` | |
6) remove osd. `ceph osd rm osd.5` | |
7) delete the deployment `kubectl delete deployment -n rook-ceph rook-ceph-osd-5` | |
8) delete osd data dir on node `rm -rf /var/lib/rook/osd5` |
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
➜ ucsf-cdhi-pedfast cat ucsf-cdhi-pefast-cephfs.yaml | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: ucsf-cdhi-pedfast-fs-pvc | |
namespace: ucsf-cdhi-pedfast | |
spec: | |
accessModes: | |
- ReadWriteMany | |
resources: |
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 | |
# Nested Unzipping, Updated for MacOS Find Utility | |
# Pavan Gupta - September 16, 2019 | |
# Drop this script into a directory with your zip file, execute, wait for nested directories | |
# TODO: Zips with zip files in them having the same name would | |
# cause unzip to drop files into the same directory causing collisions potentially | |
function extract(){ | |
unzip $1 -d ${1/.zip/} && eval $2 && cd ${1/.zip/} |
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 | |
aws_regions=(us-east-1 us-east-2 us-west-1 us-west-2 ap-south-1 ap-northeast-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 eu-central-1 eu-west-1 sa-east-1 eu-west-2 ca-central-1) | |
echo "Total regions: "${#aws_regions[@]} | |
ec2_instance_count=0; | |
rds_instance_count=0; | |
elb_count=0; | |
elasticache_count=0; | |
redshift_count=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
### The first line simply moves the files using their existing filenames, if there is a complex tree structure with the same filenames, you overrwrite fies | |
find . -type f -exec file --mime-type {} \; | awk '{if ($NF == "image/jpeg") {split($0,a,":"); print a[1]}}' | xargs -I{} cp '{}' /Users/pavan/Dental/all-images | |
### The second line adds complexity by grabbing random strings and dropping renaming the copied files randomly: | |
find . -type f -exec file --mime-type {} \; | awk '{if ($NF == "image/jpeg") {split($0,a,":"); print a[1]}}' | xargs -I{} sh -c 'cp "{}" /Users/pavan/Dental/all-images/$(cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 64).jpg' |
NewerOlder