Skip to content

Instantly share code, notes, and snippets.

@fredrikaverpil
fredrikaverpil / treewidget_example.py
Last active July 27, 2021 07:24
Tree widget example #python #pyside
from PySide import QtCore, QtGui
import sys
app = QtGui.QApplication(sys.argv)
QtGui.qApp = app
folderTree = QtGui.QTreeWidget()
header = QtGui.QTreeWidgetItem(["Virtual folder tree","Comment"])
#...
@boylea
boylea / livespec.py
Last active August 22, 2024 02:22
pyqtgraph live running spectrogram from microphone
"""
Tested on Linux with python 3.7
Must have portaudio installed (e.g. dnf install portaudio-devel)
pip install pyqtgraph pyaudio PyQt5
"""
import numpy as np
import pyqtgraph as pg
import pyaudio
from PyQt5 import QtCore, QtGui
@justinatcamfil
justinatcamfil / play_stream
Last active May 5, 2023 08:17
stream linux audio from sound card through netcat
#!/bin/bash
# run on mac in terminal
while TRUE; do
nc <server_address> 15000 | play -q -t mp3 - || echo Attempting to connect...
sleep 1;
done
@denji
denji / unbound-osx-homebrew.md
Last active November 27, 2022 08:33
Install unbound DNS(SEC) resolver on OS X, on the basis of https://www.spatof.org/blog/unbound-dns-resolver-on-osx.html
To install unbound you can use homebrew
$ brew install unbound ldns
Now we can edit the configuration file of unbound which by default is located in /usr/local/etc/unbound/unbound.conf:
@kshiteesh
kshiteesh / urlsafari
Last active January 16, 2025 02:37
This AppleScript saves all the tabs open in all Safari windows to a Markdown file.
(*
Export All Safari Tabs in All Open Windows to a Markdown File
July 13, 2015
// SCRIPT PAGE
http://hegde.me/urlsafari
// ORIGINAL SCRIPT ON WHICH THIS SCRIPT IS BUILT
http://veritrope.com/code/export-all-safari-tabs-to-a-text-file
@martinth
martinth / argparse_fileinput_demo.py
Created August 6, 2015 11:04
Read from stdin or files in Python (combining argparse and fileinput)
import argpase
import fileinput
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--dummy', help='dummy argument')
parser.add_argument('files', metavar='FILE', nargs='*', help='files to read, if empty, stdin is used')
args = parser.parse_args()
# If you would call fileinput.input() without files it would try to process all arguments.
@shubhadeep
shubhadeep / webdavclient.py
Created September 18, 2015 17:53
Python WebDAV Client
import os, sys, requests
from lxml import objectify, etree
WEBDAV_STATUS_CODE = { # See http://tools.ietf.org/html/rfc4918
'OK' : 200,
'CREATED' : 201,
'NO_CONTENT' : 204,
'MULTI_STATUS' : 207,
'NOT_FOUND' : 404,
'METHOD_NOT_ALLOWED' : 405,
@davoclavo
davoclavo / spacemacs-cheatsheet.md
Last active October 26, 2024 19:46 — forked from 526avijitgupta/spacemacs-cheatsheet.md
Spacemacs cheatsheet

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@mortn
mortn / ddns.service
Last active April 9, 2019 04:46
DDNS/DynDNS/Dynamic DNS update systemd service
[Unit]
Description=DynDNS Updater services
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/dyndns.conf
ExecStart=/usr/bin/wget -qO /tmp/dyndns.out '$DDNSURL'
@Arlen22
Arlen22 / Hosting multiple tiddlywikis on Express.md
Last active May 21, 2021 13:08 — forked from anonymous/index.js
A file to allow running multiple TiddlyWikis as seperate folders of an Express JS application. Made with 5.1.9. Amended for 5.1.14-Prerelease. My part is released into the Public Domain.
  • Download the NodeJS version of TiddlyWiki from GitHub or NPM. If you use NPM, do not use the global option (-g).
  • Put web.js beside tiddlywiki.js.
  • Require web.js from the Express application and call it on every matching request (see below).
  • For TiddlyWiki before 5.1.14-Prerelease: In core/modules/commands/server.js, seperate out the requestHandler function that is passed to http.createServer so it is on the SimpleServer prototype. Add the self variable to the first line of the requestHandler as shown.
SimpleServer.prototype.listen = function(port,host) {
	http.createServer(this.requestHandler.bind(this)).listen(port,host);
};
SimpleServer.prototype.requestHandler = function(request,response) {