Skip to content

Instantly share code, notes, and snippets.

View isfaaghyth's full-sized avatar
Work from home

Muh Isfhani Ghiath isfaaghyth

Work from home
View GitHub Profile
@waruqi
waruqi / usbproxy
Last active April 3, 2024 16:51
Set usb charles proxy for android
#!/bin/bash
if [ $1 == "1" ]; then
echo "start proxy on 127.0.0.1:8888"
adb reverse tcp:8888 tcp:8888
adb shell settings put global http_proxy 127.0.0.1:8888
adb shell settings put global https_proxy 127.0.0.1:8888
else
echo "stop proxy on 127.0.0.1:8888"
adb reverse --remove tcp:8888
@kingargyle
kingargyle / SchoolViewHolder.java
Last active June 1, 2022 12:52
Example of Unit Testing classes with Hilt @EntryPoints
public class SchoolViewHolder extends RecyclerView.ViewHolder {
private ItemSchoolBinding binding;
// @VisibleForTesting
// protected EventBus eventBus = EventBus.getDefault();
private EventBus eventBus;
public SchoolViewHolder(@NonNull View itemView) {
@manuelvicnt
manuelvicnt / AnAndroidApp.kt
Last active January 1, 2023 17:05
Hilt and AssistedInject working together in Hilt v2.28-alpha times - ViewModel version
// IMPORTANT! READ THIS FIRST
// Assisted Injection doesn't work with @HiltViewModel or @ViewModelInject
// Read more about the issue here: https://github.com/google/dagger/issues/2287
//
//
// AssistedInject and Hilt working together in v2.28-alpha times
// Example of a ViewModel using AssistedInject injected in a Fragment by Hilt
// As AssistedInject isn't part of Dagger yet, we cannot use in
// conjuction with @ViewModelInject
@dhimasanb
dhimasanb / muach.php
Created February 14, 2018 16:23
Cari 3 Level yg sama
// Koneksi.php
<?php
class Koneksi {
private $SERVER = "localhost";
private $DATABASE = "contoh_test";
private $USERNAME = "root";
private $PASSWORD = "";
private $koneksi;
public function __construct() {
@gdurastanti
gdurastanti / parallels-reset.sh
Created August 9, 2017 14:00
Reset Parallels' trial
#!/bin/sh
# Reset Parallels Desktop's trial and generate a casual email address to register a new user
rm /private/var/root/Library/Preferences/com.parallels.desktop.plist /Library/Preferences/Parallels/licenses.xml
jot -w pdu%d@gmail.com -r 1
@rocketraman
rocketraman / .gitconfig
Last active January 17, 2024 01:52
.gitconfig aliases useful for gitworkflow (https://github.com/rocketraman/gitworkflow)
[alias]
# Basically `log --oneline --decorate --graph` with different colors and some additional info (author and date)
lg = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)'
# lg (see above) with --first-parent
lgp = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)' --first-parent
# https://stackoverflow.com/questions/61510067/show-specific-commits-in-git-log-in-context-of-other-commits
hl = "!f() { cd -- ${GIT_PREFIX:-.}; grep --color -E \"$(git log --pretty=%h \"$@\" | tr '\n' '|')\" || true; }; f"
hlp = "!f() { cd -- ${GIT_PREFIX:-.}; less -R -p $(git log --pretty=%h \"$@\" | tr '\n' '|'); }; f"
@guycalledseven
guycalledseven / manual-uninstall-paragon-ntfs.sh
Last active November 14, 2023 10:48
Manually remove Paragon NTFS v15 leftovers MacOS
# after appcleaner does his magic, do this
sudo rm -rf "/Library/Application Support/Paragon Software/"
sudo rm /Library/LaunchDaemons/com.paragon-software.installer.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfsd.plist
sudo rm /Library/LaunchAgents/com.paragon-software.ntfs.notification-agent.plist
sudo rm -rf /Library/Filesystems/ufsd_NTFS.fs/
sudo rm -rf /Library/PrivilegedHelperTools/com.paragon-software.installer
sudo rm -rf /Library/Extensions/ufsd_NTFS.kext/
@NikitaKozlov
NikitaKozlov / generator.py
Last active October 17, 2021 15:20
Simple Java class generator
import sys, os, shutil
def generateClass(directory, classNumber, methodsPerClass, mainPackage):
className = "Foo" + str(classNumber)
filePath = os.path.join(directory, className + ".java")
with open(filePath,"w+") as f:
f.write("package " + mainPackage + "." + directory + ";\n")
f.write("public class " + className + " {\n")
for i in xrange(0, methodsPerClass):
f.write("public void foo" + str(i) + "(){\n")
@baconator
baconator / Main.kt
Created October 9, 2016 17:25
Minimal Kotlin + Dagger 2 in IntelliJ Example
import dagger.Component
import dagger.Module
import dagger.Provides
import javax.inject.Inject
fun main(args: Array<String>) {
val shop = DaggerCoffeeShop.builder().dripCoffeeModule(DripCoffeeModule()).build()
shop.maker().makeCoffee()
}
@wikimatze
wikimatze / gist:9790374
Created March 26, 2014 18:43
Github Two-Factor Authentication Failed For HTTPS

I heard from GitHub Two-Factor Authentication](https://github.com/blog/1614-two-factor-authentication) nearly a couple of days ago when I was reading my RSS feed. I enabled it and couldn' push to any of my repositories anymore. Learn in this blog post how to fix it.

Two-Factor Authentication

"Is a process involving two stages to verify the identity of an entity trying to access services in a computer or in a network". Github solves this authentication with sending an SMS to a device which wants to push to their platform.

Enabling Two-Factor Authentication