Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Focusing

Dimitri DO BAIRRO rimiti

🚀
Focusing
View GitHub Profile
@rimiti
rimiti / git-change-author.sh
Last active Oct 18, 2017
How to change the author (name / email) of all commits in repository ?
View git-change-author.sh
#!/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 / change-commit-date.md
Last active Jul 16, 2018
How to change lastest commit date
View change-commit-date.md

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 / mysql-dump-with-positions.sql
Last active Oct 18, 2017
Memo - Dumping your MySQL database with your points
View mysql-dump-with-positions.sql
-- 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 Oct 18, 2017
Add delay (ms) between promises
View delay.md

If you wants to add a delay between two promise:

/**
 * @description Add delay (ms) between promises
 * @param delay
 * @return {Promise}
 */
wait(delay) {
  wait(delay) {
View gist:ed3261d377aae84924f1125e04071a1b
[!] 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 Jan 31, 2018
Git - Best commands list
View Listing.md
  • Remove all local branches (except master)
git branch | grep -v "master" | xargs git branch -D
@rimiti
rimiti / index.js
Created Apr 5, 2018
Node: Await without catching ? It's really bad...
View index.js
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 / main.yml
Created Apr 26, 2018
How to install MySQL 5.7 with Ansible
View main.yml
# 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 Jun 9, 2018
Retrieving routeName from react-navigation state (redux implementation)
View index.js
/**
* @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 Jul 5, 2018
Install kubernetes on Debian 9 (online.net)
View installations.sh
#!/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
You can’t perform that action at this time.