Skip to content

Instantly share code, notes, and snippets.

View guinetn's full-sized avatar

Guinet Nicolas guinetn

View GitHub Profile
PassengerId Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
1 0 3 Braund, Mr. Owen Harris male 22 1 0 A/5 21171 7.25 S
2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Thayer) female 38 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen, Miss. Laina female 26 0 0 STON/O2. 3101282 7.925 S
4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35 1 0 113803 53.1 C123 S
5 0 3 Allen, Mr. William Henry male 35 0 0 373450 8.05 S
6 0 3 Moran, Mr. James male 0 0 330877 8.4583 Q
7 0 1 McCarthy, Mr. Timothy J male 54 0 0 17463 51.8625 E46 S
8 0 3 Palsson, Master. Gosta Leonard male 2 3 1 349909 21.075 S
9 1 3 Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27 0 2 347742 11.1333 S
@guinetn
guinetn / https_server.js
Created August 17, 2022 09:11
An HTTPS server for static content (Node.js)
/*
This module creates an HTTPS web server and serves static content
from a specified directory on a specified port.
To generate a new cert:
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
To remove the passphrase requirement:
openssl rsa -in key.pem -out newkey.pem && mv newkey.pem key.pem
Or just include the "passphrase" option when configuring the HTTPS server.
Sources:
- http://blog.mgechev.com/2014/02/19/create-https-tls-ssl-application-with-express-nodejs/
@guinetn
guinetn / ascombe-quartet-message.ipynb
Created August 14, 2022 12:33
Anscombe's quartet: Always Plot Your Data Before Jumping to Conclusions !
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@guinetn
guinetn / tasks.json
Created May 22, 2019 09:57 — forked from wolf99/tasks.json
Visual Studio Code tasks.json for GCC
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
{
"version": "0.1.0",
@guinetn
guinetn / magnitde.csv
Created January 9, 2019 14:35 — forked from ainsleymcgrath/magnitude.csv
A simple dataset to demonstrate exactly how briefly we've been present in the universe.
Stretch Name Start Year End Year
The Universe -14500000000
Sun as Main Sequence Star -4500000000 5500000000
Earth as a Physical Planet -4400000000 5500000000
Earth with Liquid Water -4400000000 1000000000
Prokaryotes -4000000000
Photosynthesis -3500000000
O2 Rich Atmosphere -2300000000
Eukaryotes -2200000000
Multicellular Life -1500000000
@guinetn
guinetn / c#_ParallelTasks.cs
Last active January 9, 2019 12:33
Run Parallel Tasks
private const int METRICSCACHE = 1000;
private const int maxParallelism = 16;
private static object Metrics_Lock = new object();
// Loop through the 'items' collection, creating maxParallelism simultaneous tasks
// Each task return a result that is save as 'metrics'
public void RunParallelTasks()
{
var tasks = new List<Task<Metric>>(maxParallelism);
@guinetn
guinetn / table.html
Created January 9, 2019 12:14 — forked from etigui/table.html
Creating HTML table dynamically using javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Table</title>
</head>
<body>
<div id="myDivTable"></div>
@guinetn
guinetn / c#_quick_pdf.cs
Last active January 9, 2019 12:15
Quick pdf with c#
// ---------------------------------------------------------------------------------------------------------------
// If you run this on Windows 10 (having it's default printer "Microsoft Print to PDF" installed - no need office)
// This should print a PDF file named "CreatedByCSharp.PDF" in your "MyDocuments" folder
// containing the string "When nothing goes right, go left"
// Microsoft Print to PDF is built-in Window 10. No Office required.
// Settings → Devices → Add Printer for more information.
// ---------------------------------------------------------------------------------------------------------------
// If not present, you will need to add a reference to System.Drawing in your project References
using System.Drawing;
@guinetn
guinetn / c#_GetObjectSizeInKo.cs
Created January 8, 2019 16:15
Return the size of a c# object
/// <summary>
/// Calculates the lenght in bytes of an object and returns its size in Ko
/// Usage:
/// int MessageSizeKo = GetObjectSize( myObject );
/// </summary>
/// <param name="TestObject"></param>
/// <returns></returns>
private int GetObjectSize(object TestObject)
{
BinaryFormatter bf = new BinaryFormatter();
@guinetn
guinetn / EasyWriteCSV.py
Created January 8, 2019 11:17 — forked from pareksha/EasyWriteCSV.py
Easy write on csv file using python (with simple file open and file write commands)
# Make directory if it doesn't exist
directory = 'media/csvs/'
if not os.path.exists(directory):
os.makedirs(directory)
path = directory + 'student_data.csv'
csvFile = open(path, 'w')
csvFile.write('Name,Contact Number,email\n')
# Iterate through queryset or list and do the following for each iteration