Skip to content

Instantly share code, notes, and snippets.

View av1m's full-sized avatar
🏡
Working from home

Avi Mimoun av1m

🏡
Working from home
View GitHub Profile
@av1m
av1m / service_account-access_token.ipynb
Last active May 31, 2022 13:41
Get an access token with a Google service account
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@av1m
av1m / getdeep.py
Last active May 30, 2022 09:19
Crosses a list or dictionary in an elegant way using list or str as key
"""Utility functions"""
from functools import reduce
from operator import getitem
from typing import Any, Mapping, Union
def getdeep(data: Mapping, map_list: Union[list, str], default: Any = None) -> Any:
"""Iterate nested dictionary|list and can return default value if key not found
@av1m
av1m / generate_schema.py
Last active September 19, 2021 02:19
Create pydantic model from meraki openapi
""" Create pydantic model from meraki openapi specifications
OpenAPI specification is available at: https://github.com/meraki/openapi
Requirements for this script:
- requests
- datamodel-code-generator
Command to run this script:
- python3 generate_schema.py
@av1m
av1m / add_url_in_copy.html
Created August 12, 2021 18:58
Javascript that allow to add a text when a user copy
<html>
Hello World
<script>
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = " (link= " + window.location.href +")";
@av1m
av1m / pip_upgrade.py
Last active December 16, 2021 00:16
Git | Github scripts
"""Updates requirements.txt to the latest version of all dependencies.
You must have == as a dependency specification
You need to define the FILE variable
"""
# coding: utf-8
import requests
FILE = "/path/to/requirements.txt"
@av1m
av1m / form_post.php
Last active October 5, 2020 13:16
Sheety.co
<?php
$sheet = "coaching";
$url = 'https://v2-api.sheety.co/1sddadce23170ca5d4718fd855qs8/testing/'.$sheet;
$data = array(
$sheet => array(
"name"=> htmlspecialchars($_POST["nom"]),
"mail"=> htmlspecialchars($_POST["mail"]),
));
$options = array(
@av1m
av1m / automate.py
Created October 1, 2020 07:42
Chromium Selenium Whatsapp
#!/usr/sbin/python3
# coding: utf-8
import socket
import pickle
import datetime
import time
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
@av1m
av1m / API.md
Last active September 19, 2022 04:54
General tricks and tips
@av1m
av1m / Fibo.java
Created April 5, 2020 11:06
Fibonacci-piano
import javax.sound.midi.*;
/**
* @author [av1m](https://www.github.com/av1m)
* @author [Ilan Nizard](https://fr.linkedin.com/in/ilan-nizard-74a222140)
* <p>
* Thanks to [@wadael](https://github.com/wadael) for the initiation
* </p>
*/
public class Fibo {
@av1m
av1m / README.md
Last active June 6, 2019 15:47
Creating row in Google Sheets with PHP

Creating row in Google Sheets with PHP

Installation and getting started

init composer

Enter this command in a terminal:
composer require google/apiclient:^2.0

init Google Console Developers Project