Skip to content

Instantly share code, notes, and snippets.

@dubcl
dubcl / nfs_exports.md
Created November 22, 2018 23:41
nfs exports

apt-get install nfs-kernel-server nfs-common

/foo *(rw,no_root_squash,sync,no_subtree_check)

/foo should be the same uid and gid on server and client

@dubcl
dubcl / elasticsearch_fix.md
Last active November 22, 2018 17:55
elasticsearch fix

First install java, elastic have problem if it's not installed

apt install openjdk-8-jre-headless

now install

apt install elasticsearch
// ==UserScript==
// @name EmuParadise Download Workaround - 1.1.1
// @version 1.1.2
// @description Replaces the download button link with a working one
// @author Eptun
// @match https://www.emuparadise.me/*/*/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant none
// ==/UserScript==
00000000: ffd8 ffe0 0010 4a46 4946 0001 0200 0001 ......JFIF......
00000010: 0001 0000 ffdb 0043 0008 0606 0706 0508 .......C........
00000020: 0707 0709 0908 0a0c 140d 0c0b 0b0c 1912 ................
00000030: 130f 141d 1a1f 1e1d 1a1c 1c20 242e 2720 ........... $.'
00000040: 222c 231c 1c28 3729 2c30 3134 3434 1f27 ",#..(7),01444.'
00000050: 393d 3832 3c2e 3334 32ff db00 4301 0909 9=82<.342...C...
00000060: 090c 0b0c 180d 0d18 3221 1c21 3232 3232 ........2!.!2222
00000070: 3232 3232 3232 3232 3232 3232 3232 3232 2222222222222222
00000080: 3232 3232 3232 3232 3232 3232 3232 3232 2222222222222222
00000090: 3232 3232 3232 3232 3232 3232 3232 ffc0 22222222222222..
@dubcl
dubcl / reset-lost-mysql-root-pass.md
Created October 17, 2018 17:29
Reset lost mysql root password

Stop mysql

service mysql stop

Start the mysqld demon process using the --skip-grant-tables option with this command

/usr/sbin/mysqld --skip-grant-tables --skip-networking &amp;
@dubcl
dubcl / fbootfix.md
Created September 27, 2018 15:41 — forked from smac89/fbootfix.md
Linux Fix Fastboot "no permissions, verify udev rules"

Determine your device id

  1. Unplug your device from the computer and type lsusb in the terminal. You should get an output similar to this:
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
@dubcl
dubcl / kafka_topic_msg_count.sh
Created September 11, 2018 19:46 — forked from clarksun/kafka_topic_msg_count.sh
get kafka topic message count
kafka-run-class kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic xxx --time -1 --offsets 1 | awk -F ':' '{sum += $3} END {print sum}'
@dubcl
dubcl / kafka-cheat-sheet.md
Created September 11, 2018 19:39 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

# Calculate the latest and earliest offsets, and provide the total # of messages in the topic (the difference):
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'provide the name of a topic to get totals against'
exit 0
fi
latest=`bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic $1 --time -1 --offsets 1 | awk -F ":" '{sum += $3} END {print sum}'`
earliest=`bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic $1 --time -2 --offsets 1 | awk -F ":" '{sum2 += $3} END {print sum2}'`
total=`expr $latest - $earliest`
@dubcl
dubcl / jconsole.txt
Created August 23, 2018 17:47
String connection for JMX on jconsole
service:jmx:rmi:///jndi/rmi://$jmxHost:$jmxPort/jmxrmi