Skip to content

Instantly share code, notes, and snippets.

@hyOzd
hyOzd / delete-file-and-buffer.el
Created July 21, 2015 11:55
emacs delete current file and close the buffer
;; based on http://emacsredux.com/blog/2013/04/03/delete-file-and-buffer/
(defun delete-file-and-buffer ()
"Kill the current buffer and deletes the file it is visiting."
(interactive)
(let ((filename (buffer-file-name)))
(if filename
(if (y-or-n-p (concat "Do you really want to delete file " filename " ?"))
(progn
(delete-file filename)
(message "Deleted file %s." filename)
@hyOzd
hyOzd / 10-marble.conf
Created October 30, 2017 18:47
Logitech Trackman Marble trackball scroll wheel emulation configuration for Linux Mint, right small button is configured for wheel emulation
# place in : /usr/share/X11/xorg.conf.d/
Section "InputClass"
Identifier "Marble Mouse"
MatchProduct "Logitech USB Trackball"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "9"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection
@hyOzd
hyOzd / reload_ext.sh
Last active January 21, 2024 01:08
Reload a cinnamon extension or applet from the command line. Useful during extension/applet development. Replace the EXTENSION_UUID at the end of the command with your extensions UUID.
# replace the EXTENSION_UUID with your extension/applet/desklet name
# replace the APPLET with other types if you are not working with an applet
dbus-send --session --dest=org.Cinnamon.LookingGlass --type=method_call /org/Cinnamon/LookingGlass org.Cinnamon.LookingGlass.ReloadExtension string:'EXTENSION_UUID' string:'APPLET'
@hyOzd
hyOzd / export_all_stl.py
Last active September 13, 2023 17:39
A small FreeCAD script to export all visible parts as STL
#
# Export All STL
#
# This is a small FreeCAD script to export all visible parts in STL
# mesh format. Files will be named as "documentname_partlabel.stl".
#
import FreeCAD
import os.path
#!/usr/bin/python3
#
# This is a script to create a KiCad symbol from STM32Cube pinout csv
# file.
#
import csv
from collections import defaultdict
import re
import pprint
from operator import itemgetter
@hyOzd
hyOzd / unfix-all-the-toolbars.user.js
Last active July 31, 2021 12:43 — forked from vbuaraujo/unfix-all-the-toolbars.user.js
GreaseMonkey script to remove "position: fixed" from webpages
// ==UserScript==
// @name unfix-all-the-toolbars
// @description Removes "position: fixed" style from elements, unfixing "toolbars" and the such.
// @namespace https://hasanyavuz.ozderya.net
// @include *
// @version 1
// @grant none
// ==/UserScript==
@hyOzd
hyOzd / export_x3d.py
Last active May 8, 2021 01:03
An experimental FreeCAD macro that will export visible objects as X3D
#
# This is an experimental FreeCAD macro that will export current scene
# as X3D file. Only the visible objects that can be converted to mesh
# will be exported with their color.
#
import FreeCAD
import FreeCADGui
import xml.etree.ElementTree as et
from PySide.QtGui import QFileDialog
@hyOzd
hyOzd / pcbannotate.py
Created July 28, 2016 00:13
a version of my pcbannotate.py script that uses native api of kicad
# -*- coding: utf-8 -*-
#
# This script will re-annotate board companents according to their x,y
# positions and back-annotate those changes to schematic files.
#
# Make sure you have backups of all your files!
#
# Forked from https://github.com/cculpepper/kicad-python/blob/master/examples/pcbannotate.py
#
# You should run the script from inside pcbnew script console. After
import cadquery as cq
from Helpers import show
BS = cq.selectors.BoxSelector
# PARAMETERS
mount_holes = True
# mold size
mw = 40
mh = 13
@hyOzd
hyOzd / plotmatrix.cpp
Created July 24, 2018 17:56
qwt plot matrix zoomer integration
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
// vim: expandtab