Skip to content

Instantly share code, notes, and snippets.

View rimiti's full-sized avatar
🚀
Focusing

Dimitri DO BAIRRO rimiti

🚀
Focusing
View GitHub Profile
@rimiti
rimiti / installations.sh
Last active July 5, 2018 08:26
Install kubernetes on Debian 9 (online.net)
#!/bin/sh
# Install common and docker
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
apt-get update && apt-get install -y docker-ce=$(apt-cache madison docker-ce | grep 17.03 | head -1 | awk '{print $3}')
# Install kubelet, kubeadm kubectl
@rimiti
rimiti / index.js
Created June 9, 2018 09:55
Retrieving routeName from react-navigation state (redux implementation)
/**
* @description Returns current route name.
* @param routes
* @returns {string}
*/
getRouteNameFromNavigatorState ({ routes }) {
let route = routes[routes.length - 1];
while (route.index !== undefined) route = route.routes[route.index];
return route.routeName;
}
@rimiti
rimiti / main.yml
Created April 26, 2018 18:23
How to install MySQL 5.7 with Ansible
# Add PGP key to install mysql 5.7 from mysql repository
- name: Add PGP key
apt_key:
keyserver: hkp://pgp.mit.edu:80
id: 5072E1F5
- name: Add official APT repository
apt_repository:
repo: "deb http://repo.mysql.com/apt/debian/ stretch mysql-5.7"
@rimiti
rimiti / index.js
Created April 5, 2018 10:12
Node: Await without catching ? It's really bad...
const Test = (ms) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
if(ms === 20) reject(new Error('Bad value'));
resolve('ok');
}, ms);
});
}
async function testUnhandled() {
@zigen
zigen / react-native-maps+0.20.1.patch
Last active March 21, 2018 23:25
how to solve module become undefined bug in react-native@0.54.0 and react-native-maps@0.20.1
patch-package
--- a/node_modules/react-native-maps/index.js
+++ b/node_modules/react-native-maps/index.js
@@ -1,4 +1,4 @@
-import MapView from './lib/components/MapView';
+import MapView from './lib/components/MapView';
export { default as Marker } from './lib/components/MapMarker.js';
export { default as Polyline } from './lib/components/MapPolyline.js';
@@ -9,7 +9,9 @@ export { default as LocalTile } from './lib/components/MapLocalTile.js';
@rimiti
rimiti / Listing.md
Last active January 31, 2018 11:04
Git - Best commands list
  • Remove all local branches (except master)
git branch | grep -v "master" | xargs git branch -D
@leymannx
leymannx / Dockerfile
Last active August 8, 2018 00:59 — forked from Majkl578/Dockerfile
[Updated PHP7.0 to PHP 7.1 ] Dockerized example for article at Pehapkari.cz about running multiple PHP versions on NGINX: https://pehapkari.cz/blog/2017/03/27/multiple-php-versions-the-easy-way/
FROM debian:stretch
ENV DEBIAN_FRONTEND noninteractive
# install NGINX
RUN apt-get update && \
apt-get install -y nginx --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
[!] 34 vulnerabilities identified from the version number
[!] Title: WordPress 4.2-4.5.1 - MediaElement.js Reflected Cross-Site Scripting (XSS)
Reference: https://wpvulndb.com/vulnerabilities/8488
Reference: https://wordpress.org/news/2016/05/wordpress-4-5-2/
Reference: https://github.com/WordPress/WordPress/commit/a493dc0ab5819c8b831173185f1334b7c3e02e36
Reference: https://gist.github.com/cure53/df34ea68c26441f3ae98f821ba1feb9c
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-4567
[i] Fixed in: 4.5.2
@rimiti
rimiti / delay.md
Last active October 18, 2017 09:45
Add delay (ms) between promises

If you wants to add a delay between two promise:

/**
 * @description Add delay (ms) between promises
 * @param delay
 * @return {Promise}
 */
wait(delay) {
 wait(delay) {
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql