Skip to content

Instantly share code, notes, and snippets.

pacmd list-sinks | grep -oPz "index: \K\d+(?=\n^\tname: <`pactl stat | grep -oP "Default Sink: \K.+"`>)"
@hyOzd
hyOzd / toggle_headset.py
Created March 25, 2015 14:53
Script to toggle bluetooth headset connection
#!/usr/bin/python
# Toggles headset connection
import dbus
from dbus.mainloop.glib import DBusGMainLoop
# change this to your device name
device_to_connect = "BlueBuds X"
dbus_loop = DBusGMainLoop()
@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
@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 / 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 / Doxyfile_html_stm32f4xx
Created July 21, 2015 12:58
doxygen file for generating STM32F4xx specific ChibiOs HAL documentation
# Doxyfile 1.8.8
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
#!/usr/bin/python
#
# Example of exporting a cadquery object to STEP using FreeCAD
#
# `FreeCAD` python module doesn't allow working with colors. For this
# we need the `FreeCADGui` module and to be able to access to objects
# `ViewObject` property. We are going to initialize FreeCADGui like
# usual, but instead of actually showing the window we will hide
# it. Note that We won't ever start the main loop at all.
#
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright © 2015 Hasan Yavuz Özderya
#
# This file is part of ecad-3d-model-generator.
#
# ecad-3d-model-generator is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of
#!/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==