This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00000000004011b0 <my_srand>: | |
4011b0: 55 push rbp | |
4011b1: 48 89 e5 mov rbp,rsp | |
4011b4: 89 7d fc mov DWORD PTR [rbp-0x4],edi | |
4011b7: 8b 7d fc mov edi,DWORD PTR [rbp-0x4] | |
4011ba: 89 3c 25 3c 40 40 00 mov DWORD PTR ds:0x40403c,edi ; 0x40403c holds rand_state | |
4011c1: 5d pop rbp | |
4011c2: c3 ret | |
4011c3: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0] | |
4011ca: 00 00 00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hashCode = str => | |
_.reduce( | |
str, | |
(acc, c) => { | |
return (acc += c.charCodeAt(0)); // + ((acc << 5) - acc); | |
}, | |
0 | |
); | |
const intToRGB = i => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==> main.py <== | |
import math | |
from Crypto.Hash import SHA256 | |
from Crypto.Util.number import getPrime, inverse, bytes_to_long, long_to_bytes, inverse, isPrime | |
import pyecm | |
def phi(p, q): | |
" Euler totient " | |
return (p - 1) * (q - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_alma(df): | |
alma = pd.DataFrame(columns=["ALMA"]) | |
close = df["close"] | |
size = len(close) | |
def ALMA(data, sigma=6, offset=0.90, size=40): | |
""" | |
Arnaud Legoux Moving Average | |
:param data: data array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0 1 2 3 4 5 6 7 8 9 A B C D E | |
# X X X X X X X X X X (parity row) | |
# +--------------------------- | |
# 64 X| X X | |
# | | |
# 32 X|X X X X | |
# | | |
# 16 X|X X X X X X | |
# | | |
# 8 | X X X X X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
web: | |
image: odoo:12.0 | |
depends_on: | |
- db | |
ports: | |
- "8069:8069" | |
volumes: | |
- odoo-web-data:/var/lib/odoo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEBUG = true; | |
const logger = (fn, label) => { | |
if (!DEBUG) | |
return fn | |
return function() { | |
console.debug('='.repeat(3), !!fn.name ? fn.name + ': ' + label : label) | |
console.debug(arguments) | |
console.debug(fn.toString()) | |
fn.apply(this, arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEBUG = true; | |
const logger = (fn, label) => { | |
if (!DEBUG) | |
return fn | |
return function() { | |
console.debug('='.repeat(3), !!fn.name ? fn.name + ': ' + label : label) | |
console.debug(arguments) | |
console.debug(fn.toString()) | |
fn.apply(this, arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Ballhausen's solution to classical reader-writers fairness problem */ | |
/* Initial problem : a continual flow of readers blocks writers from updating */ | |
/* Ballhausen's solution : | |
* * one readers takes up the same space as all readers reading together | |
* * a semaphore access_db is used by readers to enter the database with a | |
* an initial value equalling the number of readers | |
* * every time a reader is accessing the db, the semaphore value is | |
* decremented | |
* * every time a reader is leaving the db, the semaphore value is incremented | |
* * writers want exclusive access to the db. It occupies all spaces step by |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Lamport's bakery algorithm */ | |
/* Improve safety in the usage of shared resources among multiple threads by */ | |
/* means of mutual exclusion */ | |
/* Communications of the ACM, August 1974, Volume 17, Number 8, P.453 */ | |
#include <pthread.h> | |
#include <stdbool.h> | |
#include <stdio.h> |