Skip to content

Instantly share code, notes, and snippets.

View Yomguithereal's full-sized avatar

Guillaume Plique Yomguithereal

View GitHub Profile
@Yomguithereal
Yomguithereal / option1.py
Last active April 21, 2020 21:10
API CT Minet python
from minet.crowdtangle import crowdtangle_summary
for result in crowdtangle_summary(urls, token='TOKEN', start_date='2017-08-01'):
print(result.stats)
print(result.posts)
@Yomguithereal
Yomguithereal / multithreading.py
Last active January 30, 2019 23:19
Multithreaded iterators
import time
from collections import Counter
from queue import Queue
from threading import Condition, Event, Lock, Thread, Timer
# TODO: shutdown + end threads
# TODO: use thread safe urllib3
# TODO: for ordered case, we can also have an output buffer
FOREVER = 365 * 24 * 60 * 60
@Yomguithereal
Yomguithereal / bundle.json
Last active November 8, 2018 14:07
Bundle Test
This file has been truncated, but you can view the full file.
{"title":"Wikipedia Single Word","authors":[],"bundleVersion":"0.1alpha","consolidated":true,"date":"2017-10-02","defaultNodeColor":"crawling-status","defaultNodeSize":"indegree","defaultEdgeSize":"count","edgeAttributes":[{"id":"count","name":"Count","count":73832,"type":"ranking-size","integer":true,"areaScaling":{"min":10,"max":100,"interpolation":"linear"},"data":{}}],"nodeAttributes":[{"id":"crawling-status","name":"Crawling_status","count":1354,"type":"partition","integer":false,"modalities":[{"value":"FINISHED","count":1353,"color":"#666"},{"value":"UNCRAWLED","count":1,"color":"#AAA"}],"modalitiesIndex":{"FINISHED":{"value":"FINISHED","count":1353,"color":"#666"},"UNCRAWLED":{"value":"UNCRAWLED","count":1,"color":"#AAA"}},"data":{"modalitiesIndex":{"FINISHED":{"nodes":1353,"internalLinks":73803,"internalNDensity":0.12495090204793532,"inboundLinks":0,"inboundNDensity":0,"outboundLinks":29,"outboundNDensity":0.00004909795210748721,"externalLinks":29,"externalNDensity":0.00004909795210748721},"UNCRAWLED"
@Yomguithereal
Yomguithereal / cluster.py
Created November 14, 2017 15:10
FNAC Artists Sequences Clustering Script
#!/usr/bin/env python3
# Points to improve:
# 1) Distance metrics
# 2) Clustering scheme
import csv
import re
from collections import defaultdict
# Parameters
SOURCE_CSV_PATH = './uniq_artworks.csv'
@Yomguithereal
Yomguithereal / hyphe.cypher
Last active August 29, 2015 14:26
Hyphe-related cypher queries
// Getting the related nodes and avoiding irrelevant children belonging
// to other WEs.
MATCH (we:WE {name: "SCPO"})-[:PREFIX]->(:Node)-[rels:PARENT*0..]->(n:Node)
WHERE ALL(n IN extract(rel in rels | endNode(rel)) WHERE NOT (n)<-[:PREFIX]-())
RETURN n;
// Computing the WEs graph
MATCH (we:WE {name: "SCPO"})-[:PREFIX]->(:Node)-[rels:PARENT*0..]->(n:Node)
WHERE ALL(n IN extract(rel in rels | endNode(rel)) WHERE NOT (n)<-[:PREFIX]-())
@Yomguithereal
Yomguithereal / fetcher.js
Last active October 26, 2015 16:24
Baobab fetcher
const client = new APIClient(); // whatever. I use https://github.com/Yomguithereal/djax-client
const store = new LocalStore(); // whatever. A localStorage abstraction
// A tree
const tree = new Baobab({
fetchingUsers: false,
session: null,
data: {
users: []
}
@Yomguithereal
Yomguithereal / .gitignore
Last active March 25, 2024 22:52
Hacker News scraper artoo.js bookmarklet
node_modules
build
*.min.js
openssl genrsa -out key.pem 4096
openssl req -new -key key.pem -out csr.pem -subj "/C=US/ST=California/L=San Francisco/O=Local-Company/OU=dev/CN=localhost/emailAddress=test@test.com"
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
rm csr.pem