Skip to content

Instantly share code, notes, and snippets.

@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@lincolnthalles
lincolnthalles / random_memo.js
Last active May 12, 2024 01:19
Add "Random Memo" button to Memos v0.21+ sidebar
const RANDOM_MEMO_SETTINGS = {
// Amount of memos to cache
memoAmount: 100,
// Kinds of memos to cache: PUBLIC = visible to everyone, PROTECTED = logged in users, PRIVATE = only the creator
memoKinds: ["PUBLIC", "PROTECTED", "PRIVATE"],
// Time in minutes to cache the memos
memoCacheTimeMinutes: 60,
// Username of the memo creator to filter the memos
memoCreatorUsername: "",
// Button text
@Gavinok
Gavinok / eglot-codelens.el
Created March 12, 2024 22:10
Add support for code lenses in eglot for emacs
;; eglot-codelens.el --- Add support for codelenses to eglot -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
;;; Extending eglot to support lenses
;;;; Findings
;; Lenses often support the option to be used as a code action
;; some servers rely on custom code actions implemented by the client
;; - [[https://github.com/emacs-lsp/lsp-mode/issues/2250]] mentions this
@philippkraft
philippkraft / README.md
Last active May 12, 2024 01:16
Convert xyz elevation models to GeoTiff

Convert .xyz elevation models to GeoTiff

In Germany, more and more state agencies allow free access to high resolution elevation models. However, these are often released as xyz tables, which are not easily used in GIS environments. A standard method to convert this format to raster formats (eg. GeoTiff) is the GDAL function gdal_translate [1, 2]. However, converting 1M lines takes dozens of seconds and is not trivial to parallize.

@pknowledge
pknowledge / Find_and_Draw_Contours_using_OpenCV_Python.py
Created June 19, 2019 16:38
OpenCV Python Tutorial For Beginners - Find and Draw Contours with OpenCV in Python
import numpy as np
import cv2
img = cv2.imread('baseball.png')
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(imgray, 127, 255, 0)
contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
print("Number of contours = " + str(len(contours)))
print(contours[0])
@bmaupin
bmaupin / free-backend-hosting.md
Last active May 12, 2024 01:14
Free backend hosting
@korakot
korakot / record.py
Last active May 12, 2024 01:14
Record audio in Colab using getUserMedia({ audio: true })
# all imports
from IPython.display import Javascript
from google.colab import output
from base64 import b64decode
from io import BytesIO
!pip -q install pydub
from pydub import AudioSegment
RECORD = """
const sleep = time => new Promise(resolve => setTimeout(resolve, time))
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 12, 2024 01:12
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@porst17
porst17 / rc.xml
Created September 9, 2020 09:16
Openbox configuration supporting PulseAudio volume control via keyboard volumes keys (up/down/mute)
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. -->
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<resistance>
<strength>10</strength>
<screen_edge_strength>20</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>