Skip to content

Instantly share code, notes, and snippets.

@surferxo3
surferxo3 / curl.php
Last active May 15, 2024 09:12
Script to demonstrate how to extract Header and Body from the Curl response in PHP.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
// SETTINGS
ini_set('max_execution_time', 0);
@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@hfmanson
hfmanson / readme.txt
Created May 15, 2024 09:11
OTHER-WAY mazes [TEST/WIP] (Puzzlescript Next Script)
Play this game by pasting the script into https://mansoft.nl/src/editor.html
@blockpane
blockpane / firewall.sh
Last active May 15, 2024 09:11
Example of how to setup iptables to correctly filter Docker services
#!/bin/bash
### This is an example script that sets up IP tables with Docker. Many admins are not aware that UFW
### and Docker do not play well together, and accidently expose RPC ports and vulnerable services to
### the network. This replaces UFW with Netfilter-persistent and adds rules to the DOCKER-USER chain
### which is the correct way to filter incoming traffic with docker. This specific example is for a
### Tendermint node running via docker, and wireguard / ssh running directly on the host.
# CHANGE THIS TO ACTUAL PUBLIC INTERFACE!!!!!!!!!!
@HosseyNJF
HosseyNJF / README.md
Last active May 15, 2024 09:09
Delete data from exported time-series from Prometheus / VictoriaMetrics in a time range.

Usage

Note that the response cache must be deleted after these steps in order to remove previously cached results - see more details here.

@Muscliy
Muscliy / mac-cheatsheet.markdown
Last active May 15, 2024 09:05
你每天都在使用的 Mac 键盘,其实还暗藏了这些秘密

这些技巧,能让工作效率更上一个台阶

键盘,可以算是最传统的输入设备之一。在计算机尚未诞生时,就已被广泛地用在打字机上。即使是在交互方式不断突破的今天,没人能够否认,传统的键盘依然处在人机交互的中心地位。我们使用电脑的绝大部分时间都是在敲击键盘中度过的,键盘使用的熟练度和舒适度直接影响着工作效率。因此,了解、熟练使用、甚至根据个体需求改造键盘,往往能够极大的提升工作效率。在本文中,笔者将将结合自己的使用经验,探讨一些能够提升 macOS 系统的键盘使用效率的方法与技巧。

被遗忘的 Control (⌃) 与 Option (⌥)

几乎所有对 macOS 系统有一定了解的用户都知道,macOS 的系统快捷键是以 Command (⌘) 为中心的。实际上,Control 键和 Option 键也暗藏不少秘密。

Control (⌃)

@salcode
salcode / .gitignore
Last active May 15, 2024 09:00
.gitignore file for a general web project - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore
# Bare Minimum Git
# https://salferrarello.com/starter-gitignore-file/
# ver 20221125
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore
# to download this file
#

Building Kafka from the Hardware - up

  • Higher Message Retention ? - Increase disk size
  • Higher Message Throughput ? - Increase network capacity
  • Higher Producer Performance ? - Increase Disk I/O speed
  • Higher Consumer Performance ? - Increase Memory

Critical Configurations (Consumer)

  • queued.min.messages
  • fetch.wait.max.ms
  • socket.blocking.max.ms
@davidbalbert
davidbalbert / Text+String.swift
Last active May 15, 2024 08:57
Hack to extract a String from SwiftUI.Text
// Cursed! Do not use!
// Supports most, but not all Text initializers.
import SwiftUI
extension FormatStyle {
func format(any value: Any) -> FormatOutput? {
if let v = value as? FormatInput {
return format(v)
package main
import (
"encoding/json"
"fmt"
)
func main() {
b := []byte(`{"key":"value"}`)