Skip to content

Instantly share code, notes, and snippets.

@gemanepa
gemanepa / clean.sh
Created July 19, 2020 17:49 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
import React, { createContext, useContext, useReducer } from "react";
import ReactDOM from "react-dom";
const CounterContext = createContext();
const reducer = (state, action) => {
switch (action.type) {
case "ADD_TO_COUNTER": {
return {
...state,
@gemanepa
gemanepa / change-commits-author-by-name.sh
Last active May 12, 2020 15:47
Change author from all commits using author name
#!/bin/bash
git filter-branch --env-filter '
OLD_NAME="Your Old Name"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_NAME" = "$OLD_NAME" ]
then
@gemanepa
gemanepa / change-commits-author-by-email.sh
Last active May 12, 2020 15:47
Change author from all commits using author email
#!/bin/bash
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@gemanepa
gemanepa / react-UserProfiles.js
Created November 5, 2019 14:20 — forked from aerrity/react-UserProfiles.js
React example - fetch data from web API
import React from 'react';
class UserProfiles extends React.Component {
constructor(){
super();
this.state = {
name: {title: '', first: '', last: ''},
image: ''
};
// fix the this value
@gemanepa
gemanepa / gist:e506970a706aff8822dedef530a65321
Created October 17, 2019 21:38 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream