Navigation Menu

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 / git-change-author.sh
Last active October 18, 2017 08:48
How to change the author (name / email) of all commits in repository ?
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="new-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@rimiti
rimiti / mysql-dump-with-positions.sql
Last active October 18, 2017 08:48
Memo - Dumping your MySQL database with your points
-- To dump your database with your positions
mysqldump --hex-blob --routines --triggers -uroot database -r dump-with-data.sql
@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) {
[!] 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 / 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
@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() {
@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 / 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 / change-commit-date.md
Last active July 16, 2018 08:24
How to change lastest commit date

To change last commit date

GIT_COMMITTER_DATE="`date -R -v-3d`" git commit --amend --no-edit --date "`date -R -v-3d`" && git push
@rimiti
rimiti / README.md
Created July 27, 2018 08:33
Sending JSON object into form data field with request

Sending JSON object into form data field with request

How to run it?

npm i request -S