Skip to content

Instantly share code, notes, and snippets.

View exaucae's full-sized avatar

Chrys Exaucet exaucae

View GitHub Profile
@exaucae
exaucae / beta_acceptance_rejection.py
Last active January 10, 2021 20:23
monte-carlo-simulation
"""
we tackle the acceptance rejection alogorithm with the beta law
It is well established that the rejection method allows to simulate data
of the normal law N (0; 1) according to a certain algorithm.
"""
@exaucae
exaucae / mssql-convert.sql
Last active April 16, 2021 12:59
sql-server-convert
-- From datetime to string
-- The third argument of the convert function specifies the datetime format
DECLARE @date DATETIME = '2020-10-21 17:38:54.840'
BEGIN
SELECT CONVERT(varchar, @date, 115)
END
@exaucae
exaucae / .gitmodules-rm.md
Last active November 22, 2021 09:03
average to advanced git commands
  1. Delete the relevant section from the .gitmodules file. 2.Stage the .gitmodules changes: git add .gitmodules
  2. Delete the relevant section from .git/config.
  3. Remove the submodule files from the working tree and index: git rm --cached path_to_submodule (no trailing slash).
  4. Remove the submodule's .git directory: rm -rf .git/modules/path_to_submodule
  5. Commit the changes: git commit -m "Removed submodule "
  6. Delete the now untracked submodule files: rm -rf path_to_submodule

Ref: https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule

@exaucae
exaucae / k8s-memo
Last active September 15, 2021 14:45
kubernetes special tricks
# add ingress controller with minikube
minikube addons enable ingress
# verify it
kubectl get pods -n ingress-nginx \
-l app.kubernetes.io/name=ingress-nginx --watch
@exaucae
exaucae / delete-node-modules.txt
Last active April 16, 2021 12:42
Delete all nodules like a pro
Here are two way to delete node modules.
# The hard way
- cd into your target folder and according to your OS, run the appropriate command
- linux based systems: find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
- windows: FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"
# the easy way
@exaucae
exaucae / Vagrantfile
Created April 22, 2021 00:39
PostgreSQL vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/debian10"
config.vm.box_version = "3.2.2"
config.vm.box_url = "https://app.vagrantup.com/generic/boxes/debian10"
config.vm.network "forwarded_port", guest: 5433, host: 5433, host_ip: "127.0.0.1"
@exaucae
exaucae / kill-process.txt
Last active October 27, 2021 12:50
scripting utils
Windows
=======
1. netstat -ano | findstr < Port Number >
Example: netstat -ano | findstr 8080
2. taskkill /F /PID < Process Id >
Example: taskkill /F /PID 25392
@exaucae
exaucae / docker-compose.yml
Last active August 31, 2021 14:26
compose file for keycloack
version: '3.4'
networks:
keycloak-network:
driver: bridge
services:
postgres:
container_name: keycloak-db
image: postgres:latest
Workers are just scripts that runs on a separate thread from the main browser thread. Javascipt has 3 categories:
- Web workers : general purpose workers
- Service workers : proxy between the browser and the network / cache; have custom methods
- Worklets: hook into the browser’s rendering pipeline, enabling you to have low-level access to the browser’s rendering processes such as styling and layout
Workers:
- are registered in the main javascript file of your project
- do not have access to the DOM; thus get messages and props via callbacks ( postMessage & onMessage )
@exaucae
exaucae / flexbox.txt
Last active May 5, 2021 10:53
flexbox ressources
Flexbox layout is most appropriate to the components of an application, and small-scale layouts,
while the Grid layout is intended for larger scale layouts.
The main idea behind the flex layout is to give the container the ability to alter its items’ width & height (and order)
to best fill the available space.
shorthand properties:
- flex: [flex-grow] [flex-shrink] [flex-basis];
- flex-flow: [flex-direction] [flex-wrap]
References: