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 / 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
# -*- 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
@hyOzd
hyOzd / 99-sprutbrenner.rules
Created June 9, 2016 02:13
udev rules file for sprut brenner pic programmer which allows usburn to access to device without root permissions, no more sudo
# save this file in /etc/udev/rules.d/
SUBSYSTEM=="usb", ATTRS{idProduct}=="ff0b", ATTRS{idVendor}=="04d8", GROUP = "plugdev"
@hyOzd
hyOzd / sudo-this.el
Created August 25, 2016 09:29
emacs open this file as sudo
;; open this file in sudo
(defun sudo-this ()
"Open currently visited file as sudo!"
(interactive)
(if buffer-file-name
(let ((to-close (current-buffer)))
(find-file (s-concat "/sudo:root@localhost:" buffer-file-name))
(kill-buffer to-close))
(message "No file!")))
<function name="new"
c:identifier="goo_canvas_rect_new"
introspectable="0">
<doc xml:space="preserve">Creates a new rectangle item.
&lt;!--PARAMETERS--&gt;
Here's an example showing how to create a rectangle at (100,100) with a
width of 200 and a height of 100.
@hyOzd
hyOzd / kicadmenuitem.py
Created February 17, 2017 12:43
an experiment to add menu items to kicad pcbnew via scripting
import wx
def showMacros(e):
print("heey")
def findPcbnewWindow():
windows = wx.GetTopLevelWindows()
title = "Pcbnew"
pcbnew = filter(lambda w: w.GetTitle() == title, windows)
if len(pcbnew) != 1:
#!/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.
#
@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