Skip to content

Instantly share code, notes, and snippets.

View cosmincatalin's full-sized avatar
👻

Cosmin Catalin SANDA cosmincatalin

👻
View GitHub Profile
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com: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
@colorful-tones
colorful-tones / ClearDNSCache
Created June 11, 2013 14:40
clear dns cache on mac via Terminal or iTerm
sudo killall -HUP mDNSResponder
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@sandipchitale
sandipchitale / rewritehistory-main.sh
Last active October 1, 2023 22:25
Collapse all history of git repo. #git
git checkout --orphan onetime
git add -A
git commit -m "Initial commit"
git branch -D main
git branch -m main
git gc --aggressive --prune=all
git push -f origin main
@cbzehner
cbzehner / Cargo.toml
Last active September 20, 2023 08:27
Prompt for missing values in Clap
[package]
name = "clap_prompt_example"
version = "0.1.0"
edition = "2021"
[dependencies]
clap = { version = "3.1", features = ["derive"] }
dialoguer = "0.10"
@jonschoning
jonschoning / pc.laptop
Last active October 10, 2022 11:33
/usr/share/X11/xkb/symbols/pc (swap CTRL+ALT+CAPS; ALT->CTRL, CAPS->ALT) https://github.com/jonschoning/xkb_symbols
default partial alphanumeric_keys modifier_keys
xkb_symbols "pc105" {
key <ESC> { [ Escape ] };
// The extra key on many European keyboards:
key <LSGT> { [ less, greater, bar, brokenbar ] };
// The following keys are common to all layouts.
key <BKSL> { [ backslash, bar ] };
@mrchristine
mrchristine / aws_assign_eip.sh
Created September 6, 2016 18:19
Assign an elastic ip with a bootstrap script.
#/bin/bash
# Set Params
k=YOUR_AWS_KEYS
s=YOU_AWS_SECRETE
r=YOUR_REGION
# Assign EIP ID
eip_id=eipalloc-XXXXXXX
# Install awscli
@nicor88
nicor88 / bootstrap_jupyter.sh
Created April 20, 2017 10:23
Bootstrap action to install Conda and Jupyter on EMR
#!/usr/bin/env bash
set -x -e
JUPYTER_PASSWORD=${1:-"myJupyterPassword"}
NOTEBOOK_DIR=${2:-"s3://myS3Bucket/notebooks/"}
# home backup
if [ ! -d /mnt/home_backup ]; then
sudo mkdir /mnt/home_backup
sudo cp -a /home/* /mnt/home_backup
@fedir
fedir / checkUrlExists.m1.py
Last active May 25, 2022 14:56
Check if URL exists via Python
from urllib2 import urlopen
code = urlopen("http://example.com/").code
if (code / 100 >= 4):
print "Nothing there."
# via http://stackoverflow.com/questions/1966086/how-can-i-determine-if-anything-at-the-given-url-does-exist