Skip to content

Instantly share code, notes, and snippets.

touch a_file
crontab -u username a_file
@royerk
royerk / mapOfMap.hpp
Created September 11, 2019 02:43
C++ map<int, map<int, int>>
// C++17 for structure binding
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main()
@royerk
royerk / add_in_notebook.txt
Created September 12, 2019 16:32
Jupyter notebook auto reload modules magic
%load_ext autoreload
%autoreload 2
@royerk
royerk / change_ssh.sh
Created October 28, 2019 21:36
Change SSH key locally
git config --local core.sshCommand "/usr/bin/ssh -i /home/me/.ssh/id_rsa_foo"
@royerk
royerk / useful_cmd.sh
Last active December 26, 2019 18:05
Raspberry
# get core temperature
vcgencmd measure_temp
# spotify
curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
@royerk
royerk / python_bundler.py
Created May 5, 2021 16:59
Python script to merge python scripts together
import re
files_to_include = [
'my_class.py',
'dir/other_file.py',
'main.py' # << finish by main
]
output_file = 'bundled_code.py'
from airflow.providers.google.common.utils import (
id_token_credentials as id_token_credential_utils,
)
from google.auth.transport.requests import AuthorizedSession
A_GLOBAL_PARAM = 57
def invoke_container(url: str, my_param: str, **kwargs) -> bool:
with DAG(
...
) as dag:
my_task = PythonOperator(
task_id="some-name",
python_callable=invoke_container,
op_kwargs={
"url": URL,
"my_param": "toto",
},
from airflow import DAG
from airflow.decorators import task
from google.cloud import aiplatform
ENV = "my-env-name"
PIPELINE_SPEC_URI = f"gs://bucket/something/something/pipeline-spec-{ENV}.json"
PROJECT_ID = f"my-project-id-{ENV}"
REGION = "moon-southpole1"
PIPELINE_ROOT = f"gs://some-bucket/"
@royerk
royerk / ubuntu_setup.py
Last active March 7, 2023 21:57
Basic linux setup
ssh-keygen
sudo apt install git
sudo apt install curl zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# log out then back in
# vscode: https://code.visualstudio.com/docs/?dv=linux64_deb