Skip to content

Instantly share code, notes, and snippets.

@sefgit
sefgit / debugview.md
Last active March 25, 2025 07:18
DEBUG VIEW
@sefgit
sefgit / asyncio-thread.py
Created March 21, 2025 16:43
asyncio thread
# https://daily.dev/blog/get-to-know-asynchio-multithreaded-python-using-asyncawait
import asyncio
import threading
async def main():
result = await asyncio.to_thread(blocking_func)
print(result)
asyncio.run(main())
@sefgit
sefgit / README.md
Created March 15, 2025 03:24 — forked from shawnohare/README.md
asyncio socket client / server example

A basic example of using the higher level asyncio constructs such as streams in a server and client where both pass messages with regular cadence.

@sefgit
sefgit / media-query.css
Created March 12, 2025 09:29 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@sefgit
sefgit / removeItem.js
Created March 11, 2025 23:24
Node remove dict/array item
Object.prototype.removeItem = function (key) {
if (!this.hasOwnProperty(key))
return
if (isNaN(parseInt(key)) || !(this instanceof Array))
delete this[key]
else
this.splice(key, 1)
};
@sefgit
sefgit / io-redirect.js
Created March 8, 2025 05:16
redirect output to file
//
// https://zaiste.net/programming/nodejs/howtos/redirect-output-to-file-nodejs/
//
const fs = require('fs');
const { spawn } = require('child_process');
const logging = fs.createWriteStream('yourfile.log', { flags: 'a' });
const lsProcess = spawn('ls', ['-lh', '/etc']);
ls.stdout.pipe(logging);
@sefgit
sefgit / cmd.js
Created March 7, 2025 13:13
node async subprocess
//
// https://kisaragi-hiu.com/nodejs-cmd/
//
const { spawn } = require("child_process");
const process = require("process");
function cmd(...command) {
let p = spawn(command[0], command.slice(1));
return new Promise((resolveFunc) => {
p.stdout.on("data", (x) => {
@sefgit
sefgit / index.htm
Created February 4, 2025 19:54 — forked from nathanlesage/index.htm
ContentEditable Demo (CodeMirror 6)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ContentEditable Demo</title>
<script src="index.js"></script>
</head>
<body>
@sefgit
sefgit / screenshot.vue
Created January 30, 2025 09:49 — forked from bcakmakoglu/screenshot.vue
Create a screenshot of a vue flow component
<script lang="ts" setup>
import {
VueFlow,
MiniMap,
Controls,
Background,
Connection,
Edge,
Elements,
FlowElement,
@sefgit
sefgit / object-watch.js
Created January 18, 2025 00:56 — forked from Unitech/object-watch.js
object.watch polyfill
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/