Skip to content

Instantly share code, notes, and snippets.

@dedisuryadi
dedisuryadi / ssh-forward-clipboard.md
Created May 8, 2024 09:15 — forked from dergachev/ssh-forward-clipboard.md
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

@dedisuryadi
dedisuryadi / mariadb-brew-macos.md
Created April 25, 2024 03:17 — forked from nickcernis/mariadb-brew-macos.md
Install MariaDB with brew on macOS and fix the “access denied” issue

Attempting mysql -u root fails with Access denied for user 'root'@'localhost immediately after doing brew install mariadb and starting mariadb with brew services start mariadb.

To fix it (with MariaDB still running):

  1. sudo mysql then enter your Mac user password
  2. ALTER USER 'root'@'localhost' IDENTIFIED BY 'newrootpassword'; replacing newrootpassword with the password you wish to use for the MariaDB root user.
  3. Ctrl-C to exit mysql.

You should then be able to connect to MariaDB with mysql -u root -p, then entering the root password when prompted.

@dedisuryadi
dedisuryadi / README.md
Created October 21, 2023 04:47 — forked from amiorin/README.md
How to configure Home Row Mods with KMonad on macOS

Intro

Karabiner and KMonad are great open source software. Don't forget to support the authors and contributors.

If you want to try home row mods on OSX, don't use Karabiner but KMonad. KMonad is harder at the beginning but then it is easier than Karabiner. Creating layers in KMonad is trivial and without drawbacks, while it is impossible in Karabiner without drawbacks.

You need to compile a PR of the project. Install https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice/releases/download/v2.1.0/Karabiner-DriverKit-VirtualHIDDevice-2.1.0.pkg

@dedisuryadi
dedisuryadi / alternate.go
Created November 29, 2022 11:35 — forked from 808codist/alternate.go
Go + sqlite example: use custom function in trigger to validate insert
package main
// functionally same as `main.go`, with different trigger definition
import (
"database/sql"
"fmt"
sqlite "github.com/mattn/go-sqlite3"
"log"
"os"
)
@dedisuryadi
dedisuryadi / .env
Created September 29, 2022 13:49 — forked from BlockmanCodes/.env
Add liquidity to Uniswap V3
INFURA_URL_TESTNET=
WALLET_ADDRESS=
WALLET_SECRET=
@dedisuryadi
dedisuryadi / latency.markdown
Created January 4, 2022 02:09 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@dedisuryadi
dedisuryadi / ChromeURL.cs
Created March 14, 2021 15:24 — forked from bellbind/ChromeURL.cs
[windows][cs]Capturing URL from chrome address bar
// [Setup]
// Install Windows 10 SDK: https://developer.microsoft.com/ja-jp/windows/downloads/windows-10-sdk
// - check .NET 4.6.2 SDK
// copy UI*.dll from /cygdrive/c/Program\ Files\ \(x86\)/Reference\ Assemblies/Microsoft/Framework/.NETFramework/v4.6.2/
// [Build]
// /cygdrive/c/Windows/Microsoft.NET/Framework64/v4.0.30319/csc ChromeURL.cs
// /r:UIAutomationClient.dll /r:UIAutomationTypes.dll
// Find UI ELement with inspect.exe
@dedisuryadi
dedisuryadi / 2018-https-localhost.md
Created June 21, 2018 09:05 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@dedisuryadi
dedisuryadi / userChrome.css
Last active October 19, 2018 01:11
userChrome.css
/* to hide the native top tabs */
#TabsToolbar * {
visibility: collapse;
}
/* to give the top toolbar a bit of height so the window controls don't dangle off to the right */
#TabsToolbar:before {
content: '';
display: block;
width: 100%;
@dedisuryadi
dedisuryadi / index.html
Created February 27, 2016 01:53
OOSASS Example
<!-- index.html -->
<a href="#" class="btn--twitter">Twitter</a>
<a href="#" class="btn--facebook">Facebook</a>