Skip to content

Instantly share code, notes, and snippets.

@cakyus
cakyus / make.sh
Last active June 25, 2021 13:31
make in bash
#!/bin/sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
@cakyus
cakyus / index.html
Last active October 15, 2019 09:52
Text Tools
<!DOCTYPE html>
<html>
<head>
<title>Text Tool</title>
<style>
article {
position: relative;
}
nav {
position: absolute;
@cakyus
cakyus / nmon.bash
Last active January 14, 2019 03:47
Nmon data collector
#!/bin/bash
# Nmon data collector
# https://gist.github.com/cakyus/19f3c44c3fe027b06f58162974e9bd30
#
# Notes
# 1. Log directory must exist and user has write permission
# 2. Crontab example: 0 0 * * * /bin/bash /root/bin/nmon.bash
#
# This script did not:
# 1. Process nmon log
@cakyus
cakyus / CentOS-Kambing.repo
Last active January 14, 2019 03:24
Centos 6 Yum Repository Configuration using Kambing Server
[Contrib]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/$releasever/contrib/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://kambing.ui.ac.id/centos/RPM-GPG-KEY-CentOS-6
[CentOSPlus]
name=CentOS
baseurl=http://kambing.ui.ac.id/centos/$releasever/centosplus/$basearch/
@cakyus
cakyus / main.bash
Last active July 23, 2020 11:19
Bash Command Line
#!/bin/bash
if [ -z "$DEBUG" ]; then
DEBUG=0
fi
LOG_FILE=$( dirname $0 )/$( basename $0 .bash ).$( date +'%Y%m%d' ).log
logger_debug(){
if [ $DEBUG -eq 1 ]; then
@cakyus
cakyus / functions.php
Last active June 10, 2019 09:13
PHP Command Line Helper
<?php
/**
* PHP Command Line Helper
*
* Source Code
*
* https://gist.github.com/cakyus/fa8871c41e8bbe0037c107d891891cad
*
* Installation
@cakyus
cakyus / watch-dmesg.bash
Created September 25, 2018 07:30
Add timestamp to the begining of dmesg output
#!/bin/bash
#
# watch-dmesg.bash
#
# Add timestamp to the begining of dmesg output
# This is only usefull when dmesg does not support "-T" parameter
#
# Crontab Entry
# * * * * * /bin/bash /home/centos/bin/watch-dmesg.bash
@cakyus
cakyus / x-mount.sh
Last active August 29, 2015 14:05
Auto-mount unmounted devices
#!/bin/sh
for DEVICE_PATH in `ls -1 /dev/sd*[1,2,3,4,5,6,7,8,9]`
do
DEVICE_IS_MOUNTED=`mount | grep $DEVICE_PATH | wc -l`
if [ $DEVICE_IS_MOUNTED = 1 ]
then
# skip mounted device
continue
fi
@cakyus
cakyus / fsx.sh
Last active August 29, 2015 14:05
md5sum based file repository
#!/bin/sh
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9