Skip to content

Instantly share code, notes, and snippets.

@bgr
bgr / dropbox_shared_links_cleaner.js
Last active March 14, 2023 20:15
Bulk-delete Dropbox shared links
@bgr
bgr / VectorSwizzle.cs
Created May 31, 2019 08:48 — forked from grifdail/VectorSwizzle.cs
Vector swizzle in unity
using UnityEngine;
static class Vector2Swizzles {
// swizzle of size 2
public static Vector2 Swizzle_xx(this Vector2 a) { return new Vector2(a.x, a.x); }
public static Vector2 Swizzle_xy(this Vector2 a) { return new Vector2(a.x, a.y); }
public static Vector2 Swizzle_x0(this Vector2 a) { return new Vector2(a.x, 0); }
public static Vector2 Swizzle_x1(this Vector2 a) { return new Vector2(a.x, 1); }
public static Vector2 Swizzle_yx(this Vector2 a) { return new Vector2(a.y, a.x); }
@bgr
bgr / Application.qml
Created July 8, 2015 16:41
PyQt 5.5 roleNames error
import QtQuick 2.4
Item {
width: 400
height: 600
ListView {
anchors.fill: parent
model: _BE.model
delegate: Text { text: hello }
@bgr
bgr / key2midi~.pd
Created May 15, 2015 12:16
Pure Data - play midi notes using qwerty keyboard
#N canvas 132 132 682 510 10;
#X obj 13 175 list-find;
#X obj 13 83 key;
#X obj 64 82 loadbang;
#X obj 452 39 inlet;
#X text 449 15 octave shift;
#X text 38 34 q w e r t y u i o p [ ];
#X text 10 13 layout:;
#X obj 452 206 * 12;
#X obj 13 223 +;
@bgr
bgr / snippets.ly
Last active August 29, 2015 14:16 — forked from tockrock/.ignore
Lilypond snippets
\version "2.12.3"
% =========================
% = Snippetss for Lilypond =
% =========================
%
% snippets.ly
% Basic snippets for Lilypond projects
%
% Created by Takeshi Suzuki on 2010-11-30.
@bgr
bgr / pyqt_qml_gc_problem.py
Last active August 29, 2015 14:04
PyQt & QML garbage collection problem
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
import signal
from random import randint
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
@bgr
bgr / pyqt_qml_ownership_reversed.py
Created July 14, 2014 15:06
PyQt & QML ownership problem - reversed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# this code is runnable in both Python 2 and 3
from __future__ import print_function
import os
import sys
import signal
from PyQt5.QtGui import QGuiApplication
@bgr
bgr / pyqt_qml_ownership_problem.py
Last active August 29, 2015 14:03
PyQt & QML object ownership problem
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import signal
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
from PyQt5.QtCore import QUrl, QObject, QVariant, pyqtSlot
from PyQt5.QtQml import QQmlEngine, qmlRegisterType
@bgr
bgr / bgr_PS1
Last active December 31, 2015 13:58
My Bash prompt format
#!/bin/bash
# source this in .bashrc
# changes PS1 prompt format to:
#
# ┌(user@host)─(err_code)─(time date)─(git branch)─(virtualenv)
# └─(~/working/directory) $
#
# it's based on:
# http://bash.cyberciti.biz/guide/Changing_bash_prompt
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
@bgr
bgr / treeview_demo.py
Created September 19, 2013 11:32
Jython JTree demo
# Java Swing JTree demo in Jython
import java
from java.awt import Dimension, GridLayout, Toolkit, BorderLayout
from javax.swing.event import TreeModelListener
from javax.swing import (JPanel, JButton, SwingUtilities, JTree, JFrame,
JScrollPane, JTextField, ImageIcon, ToolTipManager,
JSplitPane, JEditorPane)
from javax.swing.event import TreeModelEvent
from javax.swing.tree import (DefaultTreeCellRenderer, DefaultTreeCellEditor,