Skip to content

Instantly share code, notes, and snippets.

@danilomo
danilomo / logseq_to_org.py
Created September 13, 2024 19:58
Logseq to Org roam v1
# Usage:
# - pip install marko (in a venv or system wide if you want)
# - python logseq_to_org.py <logseq's pages directory> <output folder>
import datetime as dt
import re
import sys
import uuid
from contextlib import contextmanager
from dataclasses import dataclass, field
@kickingvegas
kickingvegas / cc-org-table-to-sql.org
Last active June 7, 2024 02:21
Org Code Block cc/org-table-to-sqlite

cc/org-table-to-sqlite

Org Babel code block to import an Org table into an in-memory SQLite DB to enable SQL queries on aforementioned table.

Parameters

  • table : Org table object The Org table object is referenced via the #+NAME value assigned to the table. The table must have a header row identifying each column. This name value must be a SQL-legal name.
  • table-name : string Name of table in string form. It must be identical to the name of the table parameter above.
rule sliver_github_file_paths_function_names {
meta:
author = "NCSC UK"
description = "Detects Sliver Windows and Linux implants based on paths and function names within the binary"
strings:
$p1 = "/sliver/"
$p2 = "sliverpb."
$fn1 = "RevToSelfReq"
$fn2 = "ScreenshotReq"
$fn3 = "IfconfigReq"
@jwhitlock
jwhitlock / 2022-06-mypy-demo.md
Last active May 9, 2024 01:37
Converting fx-private-relay to use mypy

Converting fx-private-relay to use mypy

Notes for an interactive class or video

Overview

  • Intro to private relay if video
  • Starting with tag v3.5.14
    • Python 3.9 - I'm using 3.9.11
  • Django 3.2.13 - LTS version, extended support until April 2024.
@mikeckennedy
mikeckennedy / syncify.py
Last active April 2, 2023 07:02
Convert an async method to a synchronous one.
import asyncio
import functools
from typing import Any, Coroutine
loop = asyncio.new_event_loop()
def run(async_coroutine: Coroutine[Any, Any, Any]):
"""
Convert an async method to a synchronous one.
@hamelsmu
hamelsmu / sanity.ipynb
Last active March 13, 2021 14:01
GitHub Notification Sanity With `ghapi`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jph00
jph00 / py.md
Last active May 31, 2022 06:16
Organized and hyperlinked index to every module, function, and class in the Python standard library

All of the python 3.9 standard library

For a version without the collapsible details sections (so you can search the whole thing in your browser), click here.

@lantiga
lantiga / export_trace.py
Last active September 18, 2022 03:03
🤗 Huggingface Bert on RedisAI
from transformers import BertForQuestionAnswering
import torch
bert_name = "bert-large-uncased-whole-word-masking-finetuned-squad"
model = BertForQuestionAnswering.from_pretrained(bert_name, torchscript=True)
model.eval()
inputs = [torch.ones(1, 2, dtype=torch.int64),
torch.ones(1, 2, dtype=torch.int64),
@yzl
yzl / TechAndEthicsReadingCollection.md
Last active October 5, 2020 22:13
tech and ethics reading collection

Tech and ethics reading collection

A list of books, essays, papers, blog posts, tweets, etc. on tech and ethics that I have either read and found useful or plan to read because I think they might be useful. I’m not especially interested in ethics that doesn’t take power or structure into account, so most of the standard texts one would read in a course on ethics aren’t represented on my list.

(My) starting point

Not strictly about either ethics or tech, but Claire Dederer’s What Do We Do With the Art of Monstrous Men? verbalizes something that is wound up in how I think about ethics, and what I hear when people talk about ethics:

This, I think, is what happens to so many of us when we consider the work of the monster geniuses—we tell ourselves we’re having ethical thoughts when really what we’re having is moral feelings.

Ideal theory

Dr. Robin James recommends Charles Mills’ [Ideal Theory as I

@nathanKramer
nathanKramer / twitter-list-management.py
Last active January 13, 2023 00:00
Create a twitter list containing your followers or your mutuals, with idempotent `set_list` function
import twitter
api = twitter.Api(consumer_key='consumer_key',
consumer_secret='consumer_secret',
access_token_key='access_token_key',
access_token_secret='access_token_secret')
u = api.VerifyCredentials()
def create_list(name='Untitled', mode='private'):