Skip to content

Instantly share code, notes, and snippets.

View gregdeane's full-sized avatar

Greg Deane gregdeane

  • Berlin, Germany
  • 14:40 (UTC +02:00)
View GitHub Profile
@gregdeane
gregdeane / notes.md
Last active April 20, 2023 14:17
Downgrade iOS (iPhone)

Notes

Read these notes before proceeding

In order to downgrade to the previous major version (e.g. iOS 10 to iOS 9), important and regular action must be taken. For the downgrade to work, you must be proactive and prepare for a problem. Namely:

  • Archiving backups
  • Restoring the .ipsw file

Without regular attention to the two steps above, it may not be possible to truly downgrade the iOS version.

@gregdeane
gregdeane / postgres_queries_and_commands.sql
Created September 21, 2022 06:37 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@gregdeane
gregdeane / bash-ps1.txt
Last active April 16, 2022 23:21
Customize BASH PS1 prompt to show current GIT repository and branch
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
@gregdeane
gregdeane / .zshrc
Last active March 26, 2022 20:47 — forked from cjhowald/.zshrc
Zsh + oh my zsh config
# Path to your oh-my-zsh installation.
export ZSH=/Users/chowald/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.

Squash your commits using git interactive rebase

The steps below assume that:

  • you use command-line for git and are using MacOS
  • you are working on a feature branch
  • vim is the default editor.

Notes

  • While in interactive rebase mode, the commits are in the opposite order of the way git log shows them.
  • When you see a command like SHIFT + :, the plus sign should not be pressed.
@gregdeane
gregdeane / compression.md
Created May 8, 2017 05:35
Helpful Terminal Commands

Compression

  • tar cf file.tar files - create a tar named file.tar containing files
  • tar xf file.tar - extract the files from file.tar
  • tar czf file.tar.gz files - create a tar with Gzip compression
  • tar xzf file.tar.gz - extract a tar using Gzip
  • gzip file - compresses file and renames it to file.gz
  • gzip -d file.gz - decompresses file.gz back to file
@gregdeane
gregdeane / git-autocompletion.bash
Created September 21, 2021 04:07
Git auto-completion
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@gregdeane
gregdeane / hide-all-config-except-physics.md
Created June 5, 2020 09:07
vis-network / physics demo
// https://visjs.github.io/vis-network/examples/network/other/configuration.html

// run this in the console
let nodesRaw = document.querySelectorAll('.vis-config-item');
let nodesArray = Array.from(nodesRaw);

let physics = nodesArray.slice(0, nodesArray.length - 16);

physics.forEach(item =&gt; {
@gregdeane
gregdeane / .bash_profile
Last active January 2, 2020 14:15
Machine setup
# standard aliases
alias www="cd ~/www"
alias gist="cd ~/www/gist"
# npm-related aliases
alias npmlist="npm list -g --depth=0"
# git-related aliases
alias recent='for k in `git branch | perl -pe s/^..//`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r | head'
alias listr="git for-each-ref refs/remotes/ --format='%(authorname) %(refname)' --sort=authorname"
@gregdeane
gregdeane / ssh-known-hosts-mgmt.sh
Last active July 12, 2019 14:56 — forked from bradland/ssh-known-hosts-mgmt.sh
SSH known_hosts tools
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
# ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
ssh-keyscan -H github.com > ~/.ssh/known_hosts
# Scan known hosts