Skip to content

Instantly share code, notes, and snippets.

@coin8086
coin8086 / using-proxy-for-git-or-github.md
Last active June 22, 2024 11:41
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@gwagroves
gwagroves / drush.bash
Last active July 22, 2021 09:59
Drupal 8 Drush export config to gzip tar
# Change working directory to a temporary location
cd ~/temp
# Export config to "config" directory
# Change `@mysite.local` to your local drush alias
drush @mysite.local config-export --destination=~/temp/config
# Tar all files in "config" directory to `config.tar.gz`
tar -czf config.tar.gz -C config .
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@bdkosher
bdkosher / Unzipper.groovy
Created May 20, 2013 20:38
Groovy class for examining/extracting zip files.
import java.util.zip.*
/**
* Makes it easier to unzip files by adding extraction methods to the entries themselves and providing Closure-based methods for finding specific entries.
*
* For example, to extract all XML files to a certain directory:
* <code>
* new Unzipper(zip).findAllEntries { it.name.endsWith(".xml") }.each { it.extractTo(someDir) }
* </code>
*/
@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.