This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have this in views.py | |
def connection_factory(auth_class, pubsub): | |
class GeneratedConnection(websocket_connection_factory(auth_class, pubsub)): | |
def open_connection(self): | |
log(self.authenticator) | |
return super(GeneratedConnection, self).open_connection() | |
def close_connection(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have this in settings.py: | |
OMNIBUS_CONNECTION_FACTORY = 'server.views.connection_factory' | |
OMNIBUS_AUTHENTICATOR_FACTORY = 'omnibus.factories.userauthenticator_factory' | |
I have this in views.py | |
def connection_factory(auth_class, pubsub): | |
class GeneratedConnection(websocket_connection_factory(auth_class, pubsub)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import shutil | |
import subprocess | |
path = "/some/path" | |
destpath = "/some/other/path" | |
to_match = "Maybe an Artist name" | |
filenames = next(os.walk(path))[2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mpc --no-status --wait update && | |
mpc --no-status crop && | |
mpc --no-status add '' | |
mpc --no-status random on && | |
mpc --no-status crossfade 10 && | |
mpc --no-status consume on && | |
mpc play && | |
killall mpc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Depends on the gxmessage package | |
# This is a script that will check all git repos in the location array | |
# Then it will check the output length of git diff | |
# If there's output in any of them it will show a red warning with their location | |
# If not it will show an "All good" message in green | |
# This is useful to keep various git repos in check with a simple command (or keypress if you map it) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For instance: | |
// If s = <code><code>This is a nested code that should be replaced</code> <div>Any tag here is replaced</div></code> | |
// safeparse(s, "code", "code") returns: | |
// <code><code>This is a nested code that should be replaced</code> <div>Any tag here is replaced</div></code> | |
// It should work for any number of correctly written nests. | |
// This will be applied to all specified top level tags. | |
// chars is the text to be parsed | |
// s1 is the starting tag | |
// s2 is the closing tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
generate_favicon = function(color) | |
{ | |
let canvas = document.createElement("canvas") | |
canvas.height = 256 | |
canvas.width = 256 | |
let context = canvas.getContext("2d") | |
let center = canvas.height / 2 | |
let side = 192 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const vscode = require('vscode') | |
const cl_regex = new RegExp(/^\s*$/, "g") | |
function count_empty_lines() | |
{ | |
let editor = vscode.window.activeTextEditor | |
if(!editor) | |
{ | |
return false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_random_int = function(args={}) | |
{ | |
let def_args = | |
{ | |
min: 0, | |
max: 1, | |
exclude: false, | |
seed: Math.random | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Wordz = function() | |
{ | |
const wordz = {} | |
wordz.words = | |
[ | |
"aardvark", "abacus", "abbey", "abdomen", "ability", "abolishment", "abroad", "abuse", | |
"accelerant", "accelerator", "access", "accident", "accommodation", "accompanist", "accordion", "account", | |
"accountant", "achiever", "acid", "acknowledgment", "acoustic", "acoustics", "acrylic", "act", | |
"action", "activity", "actor", "actress", "acupuncture", "ad", "adapter", "addiction", |
OlderNewer