Skip to content

Instantly share code, notes, and snippets.

View tiberiuichim's full-sized avatar
🎯
Focusing

Tiberiu Ichim tiberiuichim

🎯
Focusing
View GitHub Profile
@david-batranu
david-batranu / rename.py
Created April 19, 2018 17:33
Rename and move Plone/Zope objects without triggering events
portal = app['Plone']
catalog = portal['portal_catalog']
src = portal['src_folder']
dst = portal['dst_folder']
orig = [
'name1',
import zExceptions
from Products.CMFPlone.factory import addPloneSite
from Products.Five.browser import BrowserView
import plone.api
from plone.app.textfield.value import RichTextValue
from plone.app.theming.browser.controlpanel import ThemingControlpanel
import json
import lxml.html
@rsperl
rsperl / Makefile #snippet
Last active April 3, 2025 14:04
self-documenting makefile with colors
SHELL=/bin/bash
# to see all colors, run
# bash -c 'for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done'
# the first 15 entries are the 8-bit colors
# define standard colors
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
@DarthSim
DarthSim / 00.imgproxy_vs_alternatives.md
Last active May 27, 2025 03:12
imgproxy vs alternatives benchmark

imgproxy vs alternatives benchmark

Setup

  • c5.xlarge AWS instance: 4 CPUs, 8 GB RAM
  • Ubuntu 18.04
  • Go 1.12
  • Python 2.7
  • Vips 8.7.4
@thomwolf
thomwolf / top-k-top-p.py
Last active March 11, 2025 03:44
Sample the next token from a probability distribution using top-k and/or nucleus (top-p) sampling
def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=-float('Inf')):
""" Filter a distribution of logits using top-k and/or nucleus (top-p) filtering
Args:
logits: logits distribution shape (vocabulary size)
top_k >0: keep only top k tokens with highest probability (top-k filtering).
top_p >0.0: keep the top tokens with cumulative probability >= top_p (nucleus filtering).
Nucleus filtering is described in Holtzman et al. (http://arxiv.org/abs/1904.09751)
"""
assert logits.dim() == 1 # batch size 1 for now - could be updated for more but the code would be less clear
top_k = min(top_k, logits.size(-1)) # Safety check
@00sapo
00sapo / init.vim
Last active January 9, 2025 00:55
A neovim distribution for data science
" GistID: b96887c96646762730cacf99a1c4c36d
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" README:
" This configuration file is intended for neovim, but most of it should also
" work on vim. It works out of the box with nvim-qt or similar gui and with
" alacritty or other modern terminals.
"
@heyitsaamir
heyitsaamir / withCurrentSelection.ts
Created May 23, 2020 18:11
Simple HOC to maintain current selection of the editor (slatejs)
import React, { useContext, useRef } from 'react';
import { isEqual } from 'lodash';
import { Range } from 'slate';
import { ReactEditor, useSlate } from 'slate-react';
export const CurrentSelectionContext = React.createContext<{
current: Range | null;
}>({ current: null });
@clee
clee / voron_sensorless.md
Last active February 18, 2025 03:10
how to sensorless XY on Vorons

Setting Up and Calibrating Sensorless XY Homing

When using the TMC2130 / TMC2209 / TMC2660 / TMC5160 drivers, the StallGuard feature makes it possible to set up sensorless homing on the X and Y axes for CoreXY machines. The Klipper project has a page with documentation and recommendations on getting it working.

Following are some more detailed instructions and suggestions to supplement the Klipper documentation specifically for Vorons.

Hardware Setup

@rnixx
rnixx / volto-sandbox.rst
Last active February 10, 2023 10:32
Create and install an environment for volto development on a linux machine (debian based)

How to bootstrap a volto project

Install Node package manager (npm). It is the tool required to install JavaScript packages and libraries:

sudo apt install npm

Install Node version manager (nvm). Volto frontend requires a Node.js server for resource delivery and server side rendering. Node version manager is a tool which helps running the version of Node.js required by Volto:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
@Tostino
Tostino / inkbot-one-shot.txt
Last active November 20, 2024 16:28
Generate a one-shot summary prompt example
<#meta#>
- Date: 2023-10-05
- Task: summary
<#system#>
Your main objective is to condense the content of the document into a concise summary, capturing the main points and themes.
<#chat#>
<#user#>
Please read the provided Original section to understand the context and content. Use this understanding to generate a summary of the Original section. Separate the article into chunks, and sequentially create a summary for each chunk. Focus on summarizing the Original section, ignoring any details about sponsorships/advertisements in the text.
Summarized Sections: