Skip to content

Instantly share code, notes, and snippets.

@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
#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 / 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
@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]

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 / README.md
Created April 14, 2022 03:26 — forked from magnetikonline/README.md
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
@hyuni
hyuni / PhonecallReceiver.java
Created April 14, 2022 03:31 — forked from ftvs/PhonecallReceiver.java
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@hyuni
hyuni / readme-mde.md
Created April 14, 2022 07:08 — forked from ThePredators/readme-mde.md
Setup Mobile Development Environment

⭐ Setup Mobile Development Environment (Tested on macOS M1+Intel)

Install HomeBrew

## Install xcode utils
xcode-select --install
## Install Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@hyuni
hyuni / Brewfile
Created April 14, 2022 07:08 — forked from ryanhanwu/Brewfile
New Mac Setup Script 2021
# Taps
tap 'homebrew/cask-fonts'
tap 'homebrew/cask-versions'
tap 'heroku/brew'
# Install CLI Tools
## Shell Utilities
brew 'coreutils'
brew 'findutils'
brew 'autojump'
@hyuni
hyuni / gist:968fc19cbc9904fbde72b0a82073c055
Created April 14, 2022 07:16 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat