Skip to content

Instantly share code, notes, and snippets.

View nara-l's full-sized avatar

Lawrence Nara nara-l

View GitHub Profile
git reset --hard HEAD~1
This would delete last commit https://stackoverflow.com/a/1338744
@nara-l
nara-l / gist:5a9110ba62930ce9f3aacfff6e307a82
Created February 22, 2023 00:13 — forked from teja156/gist:8c35a05f43635da4cbd06b47c0d91e93
Commands for deploying wordpress website on AWS EC2 shown in my YouTube video
YouTube video link: https://youtu.be/8Uofkq718n8
All the commands that are executed in the above youtube video are mentioned in this gist.
1. Install Apache server on Ubuntu
sudo apt install apache2
2. Install php runtime and php mysql connector
sudo apt install php libapache2-mod-php php-mysql
3. Install MySQL server
@nara-l
nara-l / Compare files across branches
Last active November 30, 2021 15:38
Git commands
1. Multiple branches:
https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory
2.https://stackoverflow.com/questions/42112526/how-to-compare-different-branches-in-visual-studio-code
@nara-l
nara-l / port_already_in_use
Created June 14, 2018 15:37
Open clogged port. Error: port already in use python on Mac
# change port number to clear the neccessary port
sudo lsof -t -i tcp:8000 | xargs kill -9
@nara-l
nara-l / Item randomizer and remover
Created September 17, 2020 16:31 — forked from swaters86/Item randomizer and remover
Randomize List Using jQuery and remove all items after the 4th item in the list.
<!doctype html>
<html>
<head>
<title>Randomize List Using jQuery</title>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<style type="text/css">
.list {
width:600px;
margin:0 auto;
@nara-l
nara-l / gist:101ef2167389e6fbb0b1a0b5861ad8b2
Created September 11, 2020 15:30 — forked from leftclickben/gist:322b7a3042cbe97ed2af
Steps to migrate from SVN to GitLab

Steps to migrate from SVN to GitLab

This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.

Setup

  • SVN is hosted at svn.domain.com.au.
  • SVN is accessible via http (other protocols should work).
  • GitLab is hosted at git.domain.com.au and:
@nara-l
nara-l / example.html
Created August 25, 2020 17:42 — forked from 981746/example.html
A simple AngularJS service for handling the 'onbeforeunload' event
<!DOCTYPE html>
<html data-ng-app="TestApp">
<head>
<script src="http://code.angularjs.org/1.2.9/angular.js"></script>
<script>
angular.module('TestApp', [])
.factory('beforeUnload', function ($rootScope, $window) {
// Events are broadcast outside the Scope Lifecycle
@nara-l
nara-l / largestRemainderRound.js
Created May 22, 2020 14:51 — forked from scwood/largestRemainderRound.js
Largest remainder round
/**
* largestRemainderRound will round each number in an array to the nearest
* integer but make sure that the the sum of all the numbers still equals
* desiredTotal. Uses Largest Remainder Method. Returns numbers in order they
* came.
*
* @param {number[]} numbers - numbers to round
* @param {number} desiredTotal - total that sum of the return list must equal
* @return {number[]} the list of rounded numbers
* @example
@nara-l
nara-l / Gitlab to Github desktop
Last active March 6, 2020 19:28
Add gitlab to github desktop
1. https://itnext.io/how-to-use-github-desktop-with-gitlab-cd4d2de3d104
@nara-l
nara-l / cherry_picking_commits
Last active December 20, 2019 21:01
GIT: Cherry Picking commits from another branch to a new branch git
# Picking specific commits from one git branch to a new one
#. 1. Create a new branch off master or any clean branch and checkout into the new branch
# 2. Use git log --pretty=oneline # on the branch with the needed commits to see the <sha> for the commits needed
# command
git cherry-pick 108e055..3f7cf07 # does not include commits from 108e055. 108e055 being the oldest commit and 3f7cf07 the lastest
git cherry-pick 108e055^..3f7cf07 # to include commits from 108e055