Instantly share code, notes, and snippets.

🔼

# Flavien Berwickflavienbwk

🔼
• Sort options
Last active Jun 6, 2019
Generates a private key from the modulus, prime1 and prime2 parameters.
View rsatool.py
 #!/usr/bin/env python2 # Usage : python rsatool.py -n -p -q -e 65537 -v DER -o private.key import base64, fractions, optparse, random try: import gmpy except ImportError as e: try: import gmpy2 as gmpy
Created May 15, 2019 — forked from erikyo/Max_Dissolved_Oxigen.c
Max Dissolved Oxigen Saturation over a range of user-specified values for water temperature, barometric pressure, and salinity or specific conductance.
View Max_Dissolved_Oxigen.c
 // --------- Max Dissolved Oxigen Saturation ------------// // // Equation for the Henry coefficient as a function of temperature and salinity is used to calculate values // for unit standard atmospheric concentrations (USAC) in freshwater and seawater in equilibrium with air at a total pressure // of 1 atmosphere. It is estimated that the possible error in the new USAC values is no greater than $\pm 0.1%$ and probably less. // Tables and equations are presented for obtaining accurate USAC values in the ranges $0^\circ < t < 40^\cir C and 0 < S < 40$. // Simple procedures are given for calculating standard atmospheric concentrations at pressures different from 1 atm. // // Reference https://water.usgs.gov/software/DOTABLES/ // Dissolved oxygen (DO) solubility over a range of user-specified values for
Created Jan 24, 2019
Coding interview problem : move all zeros present in the array to the end, and return the SAME array.
View move_zeros.py
 # Move all zeros present in the array to the end, and return the SAME array. # # I: [0, 1, 2, 0, 3, 0] # O: [1, 2, 3, 0, 0, 0] # # No empty array. # No negative numbers. def shiftZeros(array): i = 0
Created Jan 24, 2019
Coding interview problem : king and queen on a chessboard.
View king_and_queen.py
 # Given a chessboard, how would you find whether the king is threatened by the queen ? # # King position : kx, ky # Queen position : qx, qy # # There's only a queen and a king on the chessboard. # Output is True or False. def endangeredKing(k_pos, q_pos): if (q_pos[0] - k_pos[0] == 0):
Created Jan 24, 2019
Coding interview problem : find the longest consecutive sequence in a sequence.
View longest_consecutive_sequence.py
 # You have to return the longest consecutive sequence of numbers in an array. # If the input is [2, 1, 6, 9, 4, 3], the output must be [1, 2, 3, 4] # O(n) def longestSequence(sequence): hashtable = {} longest = [] for i in range(0, len(sequence)): hashtable[sequence[i]] = True for number in hashtable:
Last active Jan 24, 2019
Coding interview problem : returns the same numbers present in each given list.
View intersections_between_arrays.py
 # Find the numbers that appear in all arrays. # Return them as a list. # # Input : # [2, 6, 9, 11, 13, 17] # [3, 6, 7, 10, 13, 18] # [4, 5, 6, 9, 11, 13] # # Output must be : # [6, 13]
Last active Jan 24, 2019
Coding interview problem : prints all the subsets of a list of numbers (integers).
View all_subsets_of_a_set.py
 # This is the kind of software engineering interview algorithm you may have to do at Facebook. # You must print all the subsets of a given set. # # If the input is [1, 2, 3], you will have to print : # # 1, 2, 3, # 1, 2, # 1, 3, # 1, # 2, 3,
Created May 29, 2018
Automatically creates a fresh Wordpress install.
View myChef.sh