Skip to content

Instantly share code, notes, and snippets.

@sverweij
sverweij / highlight-graphviz-edge.html
Last active August 4, 2024 10:29
Highlight an edge in a graphviz generated svg
<!-- slap this somewhere at the top -->
<style>
/* the lines within the edges */
.edge:active path,
.edge:hover path {
stroke: fuchsia;
stroke-width: 3;
stroke-opacity: 1;
}
/* arrows are typically drawn with a polygon */
@wassname
wassname / to_filename.py
Last active March 14, 2025 09:54
python convert string to safe filename
"""
Url: https://gist.github.com/wassname/1393c4a57cfcbf03641dbc31886123b8
"""
import unicodedata
import string
valid_filename_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
char_limit = 255
def clean_filename(filename, whitelist=valid_filename_chars, replace=' '):
@b4tman
b4tman / fan_ctrl.py
Last active January 8, 2025 15:16
Включение и регулировка скорости вращения вентилятора в зависимости от температуры для Raspberry Pi с помощью программной реализации ШИМ
#!/usr/bin/env python
# coding: utf8
# скрипт мониторит температуру, и с помощью ШИМ управляет
# GPIO пином (0-3В), который должен быть подключен на базу транзистора,
# который является ключем в цепи питания вентилятора (5В).
# пример подключения вентилятора через ключ:
# https://easyeda.com/b4tman.p2p/rpi-fan-01
# параметры:
@brenopolanski
brenopolanski / merge-pdf-ghostscript.md
Last active August 16, 2025 10:10
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.

@rossant
rossant / handsondataframe.ipynb
Created March 10, 2014 12:08
Excel-like data grid editor for Pandas in the IPython notebook with Handsontable
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active August 10, 2025 11:21
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@t2psyto
t2psyto / testwin32.py
Created June 8, 2012 10:35
change Chrome window title text by python win32
import sys
import ctypes
user32 = ctypes.windll.user32
def getClassName(hwnd):
resultString = ctypes.create_string_buffer("\000" * 32)
user32.GetClassNameA(hwnd, resultString, len(resultString))
return resultString.value
@astrofrog
astrofrog / test_oo.py
Created February 13, 2011 18:48
Diagnosing Memory Leaks in Matplotlib
# Object-oriented API
#
# Memory usage (iteration, object count, memory size)
# 100 5637 1562216
# 200 5529 1491528
# 300 5422 1426264
# 400 5758 1587376
# 500 5422 1426288
# 600 5416 1440456
# 700 5610 1515056
#!/bin/bash
#
# MongoDB Backup Script
# VER. 0.1
# Note, this is a lobotomized port of AutoMySQLBackup
# (http://sourceforge.net/projects/automysqlbackup/) for use with
# MongoDB.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by