Skip to content

Instantly share code, notes, and snippets.

View isogram's full-sized avatar
🙊

Muhammad Shidiq isogram

🙊
View GitHub Profile
@isogram
isogram / editablescript.js
Created May 16, 2019 19:26
Editable Page HTML
document.body.contentEditable='true'; document.designMode='on'; void 0
@isogram
isogram / create_empty_dataframe_pyspark.py
Created June 2, 2020 07:33
Pyspark Create Empty Dataframe
from pyspark.sql.types import StringType, FloatType, StructField, StructType
from pyspark.sql import SparkSession, SQLContext, Row
import pyspark
# spark initialization
spark_context = pyspark.SparkContext.getOrCreate()
spark_session = SparkSession(spark_context) \
.builder \
.enableHiveSupport() \
.getOrCreate()
@isogram
isogram / loop_threading.py
Created April 7, 2021 06:23
Python Threading Split in For Loop
# https://stackoverflow.com/a/15144090/2212582
import threading
def process(items, start, end):
for item in items[start:end]:
try:
api.my_operation(item)
except Exception:
print('error with item')
@isogram
isogram / remote_ssh_vscode.md
Created August 26, 2021 05:21
Fix remote ssh visual code studio cannot connect server host

Failed to set up socket for dynamic port forward to remote port 40413: Socket closed. Is the remote port correct?

Follow these steps

  • Update the sshd_config file in the host machine. Follow this command: nano /etc/ssh/sshd_config and then set AllowTcpForwarding to yes
  • Restart ssh on the host machine sudo systemctl restart ssh
  • Delete the .vscode-server in host machine rm -rf /home/<user_name>/.vscode-server

Now connect through VS Code again. Hopefully it will work

@isogram
isogram / docker-compose.yml
Created December 22, 2022 09:08 — forked from bocharovf/docker-compose.yml
Complete Jaeger docker-compose deployment with ElasticSearch (oss) and Apache Kafka. Jaeger Query and Kibana to search logs and traces. Monitoring with Prometheus and Grafana.
version: "3"
services:
# Using ElasticSearch as a storage for traces and logs
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.1
networks:
- elastic-jaeger
ports:
@isogram
isogram / MySQL Query Collection.sql
Last active April 18, 2023 05:15
Get Database Size MySQL
-- Get Database Size
SELECT
table_schema AS 'Database',
SUM(data_length + index_length) / 1024 / 1024 AS 'Size (MB)'
FROM
information_schema.TABLES
GROUP BY table_schema
-- Get Table Size
SELECT