Skip to content

Instantly share code, notes, and snippets.

@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@CrookedNumber
CrookedNumber / gist:8856939
Last active September 12, 2022 17:33
How to create Trello Cards from the Command Line (with a ~10 minute set-up)
  1. This is quick and dirty and not terribly maintainable. But it's very useful for creating quick cards from the terminal. Requires familiarity with Trello and a basic understanding of bash.
  2. Log-in to Trello.
  3. Go to: https://trello.com/1/appKey/generate
  4. Make note of your key. Replace any mention of YourTrelloKey with this hash.
  5. Create a token. Go to https://trello.com/1/authorize?key=YourTrelloKey&name=SimpleBASHScript&expiration=never&response_type=token&scope=read,write in your browser and follow directions.
  6. Make note of the token. Replace any mention of YourTrelloToken with this looong hash.
  7. Pick a reasonable number of the most popular boards you use. Grab the URLs of those boards. At the same time, think of short, one-word, easy-to-remember names for each board (e.g., work, homeprojects, wedding).
  8. Grab the board IDs of the boards you chose. It'll be the ~8 character hash-like string in the URL. E.g., for https://trello.com/b/aWsGTrsD/work the ID is aWsGTrsD
  9. One by one, plug thos
Zhug
Garlic and ginger sauce
Red beans and rice
Wagyu katsu sando
Home aged steaks
Smoked ribs / brisket / pulled pork (outdoor smoker)
Canelles
Pork dumplings
Shrimp dumplings
Chacarero
@CrookedNumber
CrookedNumber / trello
Last active November 16, 2020 17:36
Sample bash script to add tickets to Trello
#!/bin/bash
if [ $# -ne 2 ]
then
echo "Usage is: $0: <board> <title>"
echo "For example: trello wedding 'Taste cakes'"
exit 1
fi
if [ $1 != 'work' -a $1 != 'homeprojects' -a $1 != 'wedding' ]
1/2 cup mayonnaise
1 tablespoon ketchup
1 tablespoon yellow mustard
4 slices kosher dill pickle
1/4 teaspoon garlic powder
1/4 teaspoon paprika
Pinch cayenne pepper
Russia
Brazil
Iran
Japan
Mexico
Belgium
South Korea
Saudi Arabia
Germany
England
<!DOCTYPE html>
<html>
<head>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<?php
// PUT THIS PAGE ON A SERVER
// AND GOT TO THE ADDRESS
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
./vendor/bin/phpunit
function srv {
if [ $# -eq 0 ]
then
port=8000
else
port="$1"
fi
php -S "localhost:$port"
}