Skip to content

Instantly share code, notes, and snippets.

# based on:
# https://stackoverflow.com/a/882770/2237916
# https://stackoverflow.com/a/53970596/2237916
import smtplib
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from os.path import basename
@silgon
silgon / peak_indicator.py
Last active April 20, 2022 18:46
peak_indicator
import pandas_datareader as pdr
import matplotlib.pyplot as plt
from statsmodels.tsa.arima_model import ARIMA
from scipy.signal import find_peaks
data = pdr.get_data_yahoo("FR.PA")
data_ = data[data.index>"2017"]
# find_peaks(data_["Volume"])
@silgon
silgon / xvfb.md
Created April 2, 2019 13:04
display
@silgon
silgon / print_py.tex
Created May 21, 2018 13:33
create pdf python code with latex
\documentclass{article}
\usepackage{listings}
\input{listings-python.prf} % defines the python-idle-code style
\usepackage{textcomp} % Needed for straight quotes
\lstset{
basicstyle=\normalsize\ttfamily, % size of the fonts for the code
language={Python},style={python-idle-code},
showstringspaces=false,
@silgon
silgon / tor_renew_ip.txt
Created April 12, 2018 14:33
Tor renew ip
sudo vi /etc/tor/torrc
#ControlPort 9051
ControlPort 9051
#CookieAuthentication 1
CookieAuthentication 0
sudo service tor restart
echo -e 'AUTHENTICATE ""\r\nsignal NEWNYM\r\nQUIT' | nc 127.0.0.1 9051
@silgon
silgon / mongo_aggregation_unwind.js
Created March 20, 2018 14:04
mongo aggregation unwind example
db.t4.insert({
"_id" : ObjectId("512e28984815cbfcb21646a7"),
"list" : [
{
"a" : ISODate("2012-12-19T06:01:17.171Z"),
"b" : 5
},
{
"a" : ISODate("2013-12-19T06:01:17.171Z"),
"b" : 5
@silgon
silgon / bluetooth.md
Created March 14, 2018 09:25
Some info about bluetooth with linux
@silgon
silgon / time_check.py
Last active January 10, 2018 10:35
Time check with server and local with http
import time
# from dateutil import parser
import requests
import pandas as pd
url = 'http://google.com'
try:
response = requests.get(url)
except Exception:
@silgon
silgon / client.py
Last active June 25, 2022 03:24
ZeroMQ interprocess communication server/client REP/REQ
import zmq
import sys
context = zmq.Context()
print "Connecting to server..."
socket = context.socket(zmq.REQ)
socket.connect ("ipc://test_hello")
@silgon
silgon / frequency_prediction.py
Last active February 16, 2018 22:56
Frequency Prediction
# code to solve https://stackoverflow.com/q/47932589/2237916
import numpy as np
import tflearn
from random import shuffle
# parameters
n_input=100
n_train=2000
n_test = 500
# generate data