Skip to content

Instantly share code, notes, and snippets.

@clemsos
clemsos / csv_to_elastic_search_bulk_insert.py
Last active February 27, 2024 10:15
Elastic Search : index large csv files with Python Pandas
from pyelasticsearch import ElasticSearch
import pandas as pd
from time import time
root_path="/home/clemsos/Dev/mitras/"
raw_data_path=root_path+"data/"
csv_filename="week10.csv"
t0=time()
@clemsos
clemsos / gitbook_to_pdf.sh
Last active August 7, 2023 04:14
Build Gitbook PDF using Pandoc
# #!/bin/bash
GITBOOK_REP=$1
SUMMARY_FILE="SUMMARY.md"
echo $OUTPUT_FILE
if [ -d "$GITBOOK_REP" ]; then
echo "Entering directory '$GITBOOK_REP'..."
cd $GITBOOK_REP
@clemsos
clemsos / sighashes.js
Last active May 25, 2022 11:13
Hardhat script to generate all 4-bytes signature hashes for all Unlock contracts (shows a markdown array in the console)
const contracts = require('@unlock-protocol/contracts')
const { ethers } = require('hardhat')
const md = (sigs) => {
// show markdown array on screen
console.log('| Type | Name | SigHash |')
console.log('|---|---|---|')
sigs.forEach(([type, name, sighash]) =>
console.log(`| ${type} | ${name} | ${sighash} |`)
@clemsos
clemsos / gensim_workflow.py
Last active February 22, 2022 11:09
How to calculate TF-IDF similarity matrix of a complete corpus with Gensim
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This script just show the basic workflow to compute TF-IDF similarity matrix with Gensim
OUTPUT :
@clemsos
clemsos / import_crater.py
Created May 6, 2021 14:48
Import data into Crater craterapp.com
import requests
import re
import json
# set headers for lavarel
headers = { "Accept": "application/json" }
# session to store cookies
sess = requests.Session()
@clemsos
clemsos / index.html
Last active June 20, 2019 07:47
Basic genetic algorithm in JS
<!--
* Basic Genetic algorithm
* JS/ES6
*
* by @clemsos, with the help of Nature of Code
-->
<button onclick="start()">START</button>
<button onclick="stop()">STOP</button>
<button onclick="init()">INIT</button>
@clemsos
clemsos / .block
Last active April 1, 2019 07:21
Market Capitalisation by Sector
license: mit
{"url":"https://link.medium.com/ZSCiKq63NU","postedBy":"clemsos","metadata":{},"context":null,"upvotes":[],"_id":"6he0NMOaIDsFIqL9"}
{"url":"https://m.isaca.org/About-ISACA/History/Documents/ISACA-Glossary-English-Chinese-Simplified_mis_Chi_0615.pdf","postedBy":"clemsos","metadata":{},"context":null,"upvotes":[],"_id":"7bMe8ECX6Aav93xc"}
{"metadata":{},"context":null,"upvotes":[],"_id":"CpmoIrxrL6WJz9D9"}
{"url":"https://docs.google.com/presentation/d/1YdrJPGRLTK2FQLy9zS-8DRHFtPbVBwX1EhrDzXnULTY/mobilepresent?slide=id.p","postedBy":"kidproto","metadata":{"name":"Google Docs","title":"EthCC 2019","description":"Ethereum 2.0 phase 0 Deep dive into the key objects","thumbnail":"https://lh4.googleusercontent.com/g21t-NmkFDCR_ju2YPmuplPyEIqQFGnqKSfLMSbLJt1S052-PJPhV4jN3Cout2bhZr7PlQ=w1200-h630-p"},"context":null,"upvotes":[],"_id":"F9kxCW7OO2cmVIej"}
{"url":"https://itnext.io/part-1-building-a-bookmark-manager-telegram-bot-node-js-vue-js-972bb7198def","postedBy":"clemsos","metadata":{"name":"ITNEXT","title":"[Part
@clemsos
clemsos / stations_clusters_1.json
Last active January 17, 2019 14:57
Weather stations clusters coordinates
[
{
"coords": [
91.75766071072317,
20.540037858066356
],
"count": 8020
},
{
"coords": [
@clemsos
clemsos / Gaussienne.ipynb
Last active October 4, 2018 12:59
Gausienne test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.