Skip to content

Instantly share code, notes, and snippets.

View billmetangmo's full-sized avatar

Bill Metangmo billmetangmo

  • France
View GitHub Profile
data "aws_iam_policy_document" "override" {
statement {
sid = "PublicReadForGetBucketObjects"
principals {
identifiers = ["*"]
type = "AWS"
}
actions = ["s3:GetObject"]
resources = [(terraform.workspace == "default") ? "arn:aws:s3:::${var.WEBSITE_BUCKET_NAME}/*" : "arn:aws:s3:::${terraform.workspace}-${var.WEBSITE_BUCKET_NAME}/*"
@billmetangmo
billmetangmo / sagemaker.sh
Last active July 6, 2023 21:55
cmds to deploy to use aws + hugging face
# https://github.com/huggingface/notebooks/blob/main/sagemaker/11_deploy_model_from_hf_hub/deploy_transformer_model_from_hf_hub.ipynb
pip install "sagemaker>=2.48.0" --upgrade
@billmetangmo
billmetangmo / scrape-email.py
Created June 10, 2023 16:19
scrape email from websites
# katana -list urls.txt -fs dn -j -o pages.json -silent
import json
import re
import csv
from concurrent.futures import ThreadPoolExecutor
def find_email_in_json_line(json_line):
# Parse the JSON line
data = json.loads(json_line)
@billmetangmo
billmetangmo / format_aws_transcript_file.py
Last active July 5, 2023 12:00
Format AWS Transcript file
import json
def transform_transcribe_output(json_output):
transcriptions = []
output = json.loads(json_output)
current_speaker_label = None
for result in output['results']['items']:
if 'speaker_label' in result:
speaker_label = result['speaker_label']
import githubAppJwt from 'universal-github-app-jwt';
import { request } from "@octokit/request";
const APPID = "XXXXXX"
// Replace with the path to your GitHub App's private key file
const PRIVATE_KEY = `YYYYYYYYYYYYYYY`;
try {
@billmetangmo
billmetangmo / errros.py
Created March 22, 2023 23:03
use rich to debug
from rich.traceback import install
install(show_locals=True)
from rich.console import Console
console = Console()
cache = Cache('prompt_cache')
try:
CMD
except Exception as e:
@billmetangmo
billmetangmo / scrape.py
Created March 15, 2023 14:08
Scrape conferences from intertesting events https://www.solutions-ressources-humaines.com
# %%
! pip install selectolax requests
# %%
import csv
with open("urls.csv") as f:
reader = csv.reader(f)
urls = list(reader)
print(urls)
var synthetics = require('Synthetics');
const log = require('SyntheticsLogger');
const recordedScript = async function () {
let page = await synthetics.getPage();
await synthetics.executeStep('Goto_0', async function() {
await page.goto("https://mtchoun-mouh.mongulu.cm/", {waitUntil: 'domcontentloaded', timeout: 60000})
})
@billmetangmo
billmetangmo / sample-atlatis.yml
Created November 21, 2022 15:01
sample atlantis
repos:
- id: $REPO
delete_source_branch_on_merge: true
workflow: datadog
apply_requirements:
- approved
- undiverged
pre_workflow_hooks:
- run: |
/usr/local/bin/rebase $REPO/c/-/merge_requests/$PULL_NUM
@billmetangmo
billmetangmo / read_json_pd.py
Created November 14, 2021 23:47
Read a file with one json per line with pandas
import pandas as pd
df = pf.read_json("chemin",lines=True)
df.columns.values
df["Useridentity"] # contient du json imbriqué
df["Useridentity"].apply(df.Series)
df["Useridentity"].apply(df.Series).columns.values # ce df a les jsons imbriqués comme colonnes
fdf = df[df["Useridentity"].apply(df.Series)["arn"].isna()] # récupéer le df avec tous ceux qui sont Nan