Skip to content

Instantly share code, notes, and snippets.

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: 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 protocal. 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
@hyuni
hyuni / draw.kt
Created December 25, 2021 09:52
matrix rotate wrong position
override fun onDraw(canvas: Canvas?) {
contentBitmap.draw(canvas)
// get rotate from matrix
val matrixRotate = contentBitmapLayer.matrix.rotation
// get contentBitmapLayer bounds from matrix
val x1 = bitmapPoints[0]
val y1 = bitmapPoints[1]
val x2 = bitmapPoints[2]
@hyuni
hyuni / layout.xml
Created January 8, 2021 03:20 — forked from kamikat/layout.xml
NestedScrollView + SwipeRefreshLayout + RecyclerView
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
#parse("File Header.java")
@hyuni
hyuni / changeXcode.sh
Last active November 3, 2019 07:20
bash shell - Xcode 11.1 on High Sierra
#!/bin/bash
array=(`find . -name "Info.plist"`)
for i in "${array[@]}"
do
val=$(/usr/libexec/PlistBuddy -c "print :LSMinimumSystemVersion" "$i" 2>/dev/null || print '0')
if [ "$val" == "10.14" -o "$val" == "10.14.4" -o "$val" == "10.15" ]; then
echo $i
@hyuni
hyuni / extractXcode.sh
Created November 3, 2019 04:25
bash shell - Xcode 10.3 on High Sierra
#!/bin/bash
#open Xcode_10.3.xip -a "Archive Utility"
cp -pi /Applications/Xcode_10.1.app/Contents/Developer/usr/bin/xcodebuild ~/Downloads/Xcode.app/Contents/Developer/usr/bin/
for bundle in ~/Downloads/Xcode.app{,/Contents/Developer/Applications/Simulator.app};
do
echo 'bundle ==> ' $bundle
defaults write "$bundle"/Contents/Info LSMinimumSystemVersion -string 10.13.6;
@hyuni
hyuni / jekyll-and-liquid.md
Created November 2, 2019 06:23 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@hyuni
hyuni / vim_cheatsheet.md
Created November 2, 2019 06:23 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@hyuni
hyuni / bash-cheatsheet.sh
Created November 2, 2019 06:22 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04