Skip to content

Instantly share code, notes, and snippets.

View ideepika's full-sized avatar
🎯
Focusing

Deepika Upadhyay ideepika

🎯
Focusing
View GitHub Profile
@ronen-fr
ronen-fr / cephs
Last active July 3, 2021 13:46
a tool to remind me what directory I am using for what branch
sample output for the short version (cephs3.sh):
-- -- tmp/rf_sc -- -- -- diverged -- wip-ronenf-scrub-sched [887-0 us:1721-0]
6a6b4501235 osd/scrub: extracting scrub scheduling code from OSD.cc
-- -- scr6 -- -- -- -- diverged -- wip-ronenf-cscrub-be [1538-0 us:1531-0]
6624e06cd2e osd/scrub: extracting scrub scheduling code from OSD.cc
9-May 13:14 build Ninja: 3-May 17:54 build/build.ninja
#!/usr/bin/env bash
#
# Instruction :
# - Save this file locally
# - Open terminal
# - execute command "source </path/to/this/file>
# - To get the smallest possible promt, execute "zbar 0"
# - Otherwise, execute command "zbar"
#
import jenkins.model.Jenkins
import hudson.model.ParametersAction
import hudson.model.BooleanParameterValue
import hudson.model.Result
import hudson.model.Run
import org.jenkinsci.plugins.workflow.job.WorkflowRun
import org.jenkinsci.plugins.workflow.support.steps.StageStepExecution
import org.jenkinsci.plugins.workflow.job.WorkflowJob
//Get the PR Number
@simonw
simonw / export-google-docs-to-restructured-text.js
Last active January 3, 2024 00:02
Google Apps script to convert a Google Docs document into reStructuredText
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu('Convert to .RST')
.addItem('Convert to .RST and email me the result', 'ConvertToRestructuredText')
.addToUi();
}
// Adopted from https://github.com/mangini/gdocs2md by Renato Mangini
// License: Apache License Version 2.0
String.prototype.repeat = String.prototype.repeat || function(num) {
@jdurgin
jdurgin / slow_ops.py
Created December 9, 2016 21:29
osd slow ops
#!/usr/bin/python
from datetime import datetime
import re
import sys
class Transaction(object):
def __init__(self, tid, start):
self.tid = tid
self.start = start

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@preshing
preshing / build_cross_gcc
Last active June 1, 2024 11:37
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet