Skip to content

Instantly share code, notes, and snippets.

View moehandi's full-sized avatar
:octocat:

M. Andi Saputra moehandi

:octocat:
  • Jakarta, Indonesia
View GitHub Profile
@moehandi
moehandi / atom-macos-context-menu.md
Created February 22, 2019 10:13 — forked from idleberg/atom-macos-context-menu.md
“Open in Atom” in macOS context-menu

Open in Atom

  • Open Automator
  • Create a new Service
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /usr/local/bin/atom -n "$@"
  • Set “Pass input” to as arguments
  • Save as Open in Atom
@moehandi
moehandi / RequestAndResponseLoggingFilter.java
Created November 20, 2018 15:55 — forked from int128/RequestAndResponseLoggingFilter.java
Spring Web filter for logging request and response
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
@moehandi
moehandi / gist:cff8a397beb954fe53c87155b23dc78c
Created October 16, 2018 03:42
android-adb_list_and_remove_app
command:
pm list packages -f
pm list packages -f | grep "opera" // for specific apps name
pm uninstall -k --user 0 package_name
example:
1. first list package to uninstall, and example line apps
shell@grandpplte:/ $ pm list packages -f | grep "line"
result:
package:/data/app/jp.naver.line.android-1/base.apk=jp.naver.line.android

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql

@moehandi
moehandi / build.gradle
Created March 7, 2018 07:54 — forked from gabrielemariotti/build.gradle
Use signing.properties file which controls which keystore to use to sign the APK with gradle.
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
@moehandi
moehandi / gist:638cfc74bd7481ce5711e04ad1cb4ec9
Created January 20, 2018 01:25
solve ubuntu expired key server
Update all expired keys from Ubuntu key server in one command:
sudo apt-key list | \
grep "expired: " | \
sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
Command explanation:
@moehandi
moehandi / gist:807d4bed13bc85fb70f0dd58588b401f
Created December 3, 2017 02:21 — forked from kapkaev/gist:4619127
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@moehandi
moehandi / verify.js
Created November 2, 2017 09:43 — forked from evanhalley/verify.js
Using JavaScript / Node.js to do server side IAB signature verification
var crypto = require('crypto');
// the Base64 encoded Google Play license key / Base64-encoded RSA public key from the Google Play Dev Console
var publicKey = "ABCEDF1234....";
/** sample
{
"orderId":"12999763169054705758.1371079406387615",
"packageName":"com.example.app",
"productId":"exampleSku",
@moehandi
moehandi / nginxproxy.md
Created November 2, 2017 04:23 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@moehandi
moehandi / main.go
Created October 22, 2017 00:40 — forked from manishtpatel/main.go
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)