Skip to content

Instantly share code, notes, and snippets.

View afriza's full-sized avatar

Afriza N. Arief afriza

  • Indonesia
  • 08:19 (UTC +07:00)
View GitHub Profile
@afriza
afriza / goroutine-id.go
Last active February 22, 2023 05:59 — forked from metafeather/main.go
Get goroutine id for debugging
package main
import (
"fmt"
"runtime"
"strings"
"sync"
)
// Goid gets goroutine ID. Only used for debugging purpose.
@afriza
afriza / setup-gpg-over-ssh-forwarding.md
Last active February 19, 2023 14:07
Remote git signing with GPG (GnuPG / GNU Privacy Guard) over SSH Forwarding

On local machine

$ brew install gnupg pinentry-mac # macOS
$ echo 'export GPG_TTY=$(tty)' >> ~/.bashrc
$ echo 'export GPG_TTY=$(tty)' >> ~/.zshrc
$ echo "pinentry-program $(command -v pinentry-mac)" > ~/.gnupg/gpg-agent.conf # macOS
$ defaults write org.gpgtools.common UseKeychain NO # macOS
$ gpgconf --kill gpg-agent
$ gpg-connect-agent /bye
@afriza
afriza / ssh-config
Created May 27, 2022 12:56
SSH client config to ignore/disable `StrictHostKeyChecking`
Host localhost 192.168.* 10.*
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
@nucther
nucther / bridge.js
Last active July 13, 2023 03:33
Enable Bridge
function displayTableHtml(){for(var e="",t="",n=0;n<all_wan_info.wan.length;n++){var i=n+1,a=all_wan_info.wan[n],l=a.wan_index+"_"+a.wan_session_index+"_"+a.iporppp+"_"+a.Name;t+='<tr id="outtable_'+n+'" style="cursor: pointer;" onclick="Showthisinfo(this.id)">',t+='<td align="center">'+i+"</td>",t+='<td align="center">'+a.Name+"</td>",t+='<td align="center">'+a.p8021+"/"+a.vlanid+"</td>","1"==a.IPMode?e="IPv4":"2"==a.IPMode?e="IPv6":"3"==a.IPMode&&(e="IPv4&IPv6"),t+='<td align="center">'+e+"</td>",t+='<td align="center"><input type="checkbox" class="delselwan" value="'+l+'"></td>',t+="</tr>"}$("#internet_list").html(t)}function setBridge(){setTimeout(()=>{$("#WanConnectMode_select").append('<option value="bridge">Bridge</option>')},1e3)}displayTableHtml(),$("td").click(()=>{setBridge()});
@nucther
nucther / get-password-fiberhome.js
Created November 14, 2021 02:31
Get Password PPPoE Indihome ( Fiberhome )
// Login to fiberhome modem
// Paste this script inside browser console
$.ajax({
url: '/cgi-bin/ajax?ajaxmethod=get_allwan_info',
success: (data)=>{
data = JSON.parse(data)
data.wan.forEach(v => {
if(v.AddressingType == 'PPPoE'){
console.log("Username: "+ v.Username)
@Hakky54
Hakky54 / openssl_commands.md
Last active April 22, 2024 16:57 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

OpenSSL 🔐

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@Harold2017
Harold2017 / buildInfo.md
Created November 1, 2019 10:14
add build info to go binary
package version

// reference: https://stackoverflow.com/questions/11354518/application-auto-build-versioning

import (
	"fmt"
	"runtime"
	"strings"
)
@ivanvermeyen
ivanvermeyen / HOWTO.md
Last active January 14, 2024 03:02
Multiple MySQL versions on MacOS with Homebrew

Update - 4 september 2020

Making multiple MySQL versions work with Homebrew was tricky to say the least. Fortunately there are 2 new easy ways that I learned of to achieve this.

DBngin app

As @4unkur and @henrytirla commented below, there is this extremely easy to use app called DBngin, which lets you setup multiple databases (not only MySQL) simultaneously using different ports:

https://dbngin.com/

@tjamet
tjamet / proxy-handler-factory.go
Last active November 10, 2022 10:15
http handler factory to proxy requests in go
func newProxyHandler(client *http.Client, backend *url.URL) http.Handler {
return http.HandlerFunc(func(ow http.ResponseWriter, r *http.Request) {
w := &loggedResponseWriter{ResponseWriter: ow}
defer func() {
log.Printf("%s %s %d %d Bytes", r.Method, r.URL.Path, w.code, w.size)
}()
req, err := http.NewRequest(r.Method, fmt.Sprintf("%s://%s", backend.Scheme, backend.Host), r.Body)
if err != nil {
log.Println("failed to call backend:", err.Error())
@Hikingyo
Hikingyo / admin.sql
Last active April 14, 2024 06:42
create admin user with all privileges on mysql/mariadb
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
## remote connection - not secure
CREATE USER 'admin'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;