This fork by rebane2001 is an improved version of the script!
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 python3 | |
""" | |
Drop-in replacement for pandas.DataFrame methods for reading and writing to database: | |
pandas.DataFrame.to_sql | |
pandas.read_sql_table | |
For some reason the current (Jan 2023) implementation in Pandas | |
using sqlalchemy is really slow. These methods are ~300x faster. |
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
// npm i axios stream-concat | |
import { pipeline } from 'stream/promises' | |
import StreamConcat from 'stream-concat' | |
import axios from 'axios' | |
const API_01 = 'http://localhost:3000' | |
const API_02 = 'http://localhost:4000' | |
const streams = (await Promise.all([ | |
axios({ |
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 struct | |
from operator import itemgetter | |
from pathlib import Path | |
def get_struct_unpacker(fieldspecs, istart, iwidth): | |
""" | |
Build the format string for struct.unpack to use, based on the fieldspecs. | |
fieldspecs is a list of [name, start, width] arrays. | |
Returns a string like "6s2s3s7x7s4x9s". |
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 | |
import logging | |
logger = logging.getLogger(__name__) | |
import argparse | |
import os.path | |
import requests | |
import shutil |
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 | |
# Get postman app | |
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz | |
sudo tar -xzf postman.tar.gz -C /opt | |
sudo ln -s /opt/Postman/Postman /usr/bin/postman | |
#Create a Desktop Entry | |
cat > ~/.local/share/applications/postman.desktop <<EOL | |
[Desktop Entry] | |
Encoding=UTF-8 |
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
########### | |
# Python 2: | |
########### | |
try: | |
raise Exception | |
except Exception as e: | |
s,r = getattr(e, 'message') or str(e), getattr(e, 'message') or repr(e) | |
print 's:', s, 'len(s):', len(s) | |
print 'r:', r, 'len(r):', len(r) | |
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
# AES helper class for pycrypto | |
# Copyright (c) Dennis Lee | |
# Date 22 Mar 2017 | |
# Description: | |
# Python helper class to perform AES encryption, decryption with CBC Mode & PKCS7 Padding | |
# References: | |
# https://www.dlitz.net/software/pycrypto/api/2.6/ | |
# http://japrogbits.blogspot.my/2011/02/using-encrypted-data-between-python-and.html |
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
function base64url(source) { | |
// Encode in classical base64 | |
encodedSource = CryptoJS.enc.Base64.stringify(source); | |
// Remove padding equal characters | |
encodedSource = encodedSource.replace(/=+$/, ''); | |
// Replace characters according to base64url specifications | |
encodedSource = encodedSource.replace(/\+/g, '-'); | |
encodedSource = encodedSource.replace(/\//g, '_'); |
NOTE: Possible use the Cryptography package instead.
Install Python pycrypto_ package.
NewerOlder