Skip to content

Instantly share code, notes, and snippets.

@vitaly-t
vitaly-t / retry-async.ts
Last active January 19, 2025 23:38
retry-async
/**
* Retry-status object type, for use with RetryCB.
*/
export type RetryStatus = {
/**
* Retry index, starting from 0.
*/
index: number,
/**
* Retry overall duration, in milliseconds.
@ramann
ramann / IncapsulaCefToJson.py
Created August 21, 2018 22:31
Convert CEF logs (from Incapsula) to JSON
# Script to convert CEF logs (from Incapsula) to JSON
import re
import json
import itertools
test = 'CEF:0|Incapsula|SIEMintegration|1|1|IncapRules(bad client)|11| fileId=295037710147327529 sourceServiceName=example.com siteid=10286633 suid=2047415 requestClientApplication=Mozilla/5.0 (compatible; Windows NT 6.1; Catchpoint) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 deviceFacility=hkg cs2=false cs2Label=Javascript Support cs3=false cs3Label=CO Support src=110.202.200.66 cs1=NA cs1Label=Cap Support cs4=b4010c9c-14b7-4ce5-88e1-a5030cefa1e5 cs4Label=VID cs5=018cc31e00c7af9d29fb2058854cc90ccdd1c753ee28980c54416fe51f565f10eecacbc03108eeebe7554343a3c35bcc31da0cfc81013f2b8cbd5326ec0987ee4a4ea28155765b053669bcf12622383a7dc1702b74a21647b9f9fd9e6421b234 cs5Label=clappsig dproc=Site Helper cs6=Catchpoint cs6Label=clapp ccode=CN cicode=Shanghai cs7=31.0456 cs7Label=latitude cs8=121.3997 cs8Label=longitude Customer=Test - External ver= TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 start=15247708020
@yifanzz
yifanzz / code-editor-rules.md
Created December 17, 2024 00:01
EP12 - The One File to Rule Them All

[Project Name]

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.

Project Context

[Brief description ]

  • [more description]
  • [more description]
  • [more description]
@samiraguiar
samiraguiar / MC Cheat Sheet
Last active January 19, 2025 23:33 — forked from maciakl/MC Cheat Sheet
Midnight Commander Cheat Sheet / Shortcuts
Note for newcomers:
In the shortcuts below, "C" stands for CTRL and "A" stands for "ALT". This is a convention
used in the Midnight Commander documentation and was kept here.
You can also use "ESC" instead of "ALT", which is useful on Macbooks.
Main View
---------------------------------------------------------------
- File/directory operations
@amjad489
amjad489 / remove_duplicates.py
Created July 20, 2019 09:05
# Remove duplicates from JSON using python
data = [
{
"Name":"1231",
"Age":"1",
"Location":"Sydney",
},
{
"Name":"12314",
"Age":"3",
"Location":"Dubai",
import cv2
import time
import numpy as np
import multiprocessing as mp
log_const = 30
shared_frame = mp.RawArray('B', 2764800)
camera_dims = (720, 1280, 3)
  • repo -> repository

  • clone -> bring a repo down from the internet (remote repository like Github) to your local machine

  • add -> track your files and changes with Git

  • commit -> save your changes into Git

  • push -> push your changes to your remote repo on Github (or another website)

  • pull -> pull changes down from the remote repo to your local machine

  • status -> check to see which files are being tracked or need to be commited

  • init -> use this command inside of your project to turn it into a Git repository and start using Git with that codebase

# สร้าง bucket
gsutil mb gs://[BUCKET]
# ลิสต์ files ใน bucket
gsutil ls gs://[BUCKET]
# ดูว่า bucket ขนาดเท่าไร (du: disk usage)
gsutil du -sh gs://[BUCKET]
@dioncodes
dioncodes / server-status-widget.js
Last active January 19, 2025 23:24
Scriptable iOS Server Status Widget
const initialData = {
servers: [
{
url: 'https://1.example.com/',
title: 'Server 1',
online: null,
},
{
url: 'https://2.example.com/',
title: 'Server 2',
#version 300 es
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
out vec4 fragColor;
uniform vec2 resolution;
uniform vec3 orientation;