Skip to content

Instantly share code, notes, and snippets.

View anak10thn's full-sized avatar
🌴
Maaf gak di rumah

Ibnu Yahya (Eka) anak10thn

🌴
Maaf gak di rumah
View GitHub Profile
@anak10thn
anak10thn / mysql2sqlite.sh
Created June 11, 2023 12:43 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@anak10thn
anak10thn / README.md
Created March 2, 2023 12:40 — forked from porsager/README.md
A websocket middleware for express

A websocket middleware for express

A convenient way to expose a websocket connections in route handles.

Usage

const express = require('express')
    , ws = require('./ws')
@anak10thn
anak10thn / websocket-client.js
Created March 2, 2023 12:11 — forked from ErickWendel/websocket-client.js
Pure WebSocket Node.js Server using Native HTTP Module
// make a request
const options = {
port: 1337,
host: 'localhost',
headers: {
'Connection': 'Upgrade',
'Upgrade': 'websocket'
}
};
const protocol = 'http'

UPDATE:

These results are invalid. Some of the server implementations don't parse correctly and rust-tokio/ponylang-tcp don't seem to parse at all. See here for better benchmarks: https://gist.github.com/kprotty/5a41e9612657de00788478a7dde43d78

====

wrk -t4 -c128 -d10 --latency http://localhost:12345

  • Machine:
    • Intel Core i7-6700k (4 cores, 8 threads, 4.2ghz)
    • 16GB DDR4 2400mhz RAM
    • Arch Linux, Kernel 5.2.8
@anak10thn
anak10thn / download_file.rs
Created September 14, 2022 02:59 — forked from giuliano-macedo/download_file.rs
Download large files in rust with progress bar using reqwest, future_util and indicatif
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
@anak10thn
anak10thn / React-Native-WebView-Cookies.js
Created September 5, 2022 01:38 — forked from kanzitelli/React-Native-WebView-Cookies.js
React Native Trick: Get Cookies of WebView without using any native modules such as react-native-cookies. Might be helpful for getting JWT while making OAuth2 👽
// @flow
import React, { Component } from 'react';
import {
WebView,
} from 'react-native';
class LoginScreen extends Component {
state = {
cookies : {},
@anak10thn
anak10thn / email.go
Created July 30, 2022 07:46 — forked from carelvwyk/email.go
Building an email in Golang to be delivered using Amazon SES
func buildEmailInput(source, destination, subject, message string,
csvFile []byte) (*ses.SendRawEmailInput, error) {
buf := new(bytes.Buffer)
writer := multipart.NewWriter(buf)
// email main header:
h := make(textproto.MIMEHeader)
h.Set("From", source)
@anak10thn
anak10thn / recompile-and-run.sh
Created March 9, 2020 23:45 — forked from PuKoren/recompile-and-run.sh
Recompile APK + Sign with apktool
# You must first install apktool (https://github.com/iBotPeaches/Apktool) and android SDK
# and decompile apk using it
# apktool d -rf my-app.apk
# then generate a key for sign in:
# keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
rm signed-app.apk
apktool b -f -d com.myapp
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore com.myapp/dist/com.myapp.apk alias_name
zipalign -v 4 com.myapp/dist/com.myapp.apk signed-app.apk
@anak10thn
anak10thn / docker-compose.yaml
Created March 4, 2020 12:30 — forked from ayubmalik/docker-compose.yaml
Kafka REST proxy with Docker compose. Everything required to get Confluent REST proxy docker images working so you can post messages to consumers with curl etc
---
version: '3.5'
networks:
default:
name: kafka-net
services:
zookeeper:
image: confluentinc/cp-zookeeper:4.1.1
hostname: zookeeper
#!/bin/zsh
alias dos="toilet -f mono12 -F metal -t"
alias dosg="toilet -f mono12 -F gay -t"
clear
echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";echo "";
dos "Apa yang kau";dosg "harap di bumi...."
sleep 2.5
clear