Skip to content

Instantly share code, notes, and snippets.

@bronsen
bronsen / feierabend.sh
Last active May 18, 2022 07:36
feierabend!
#!/usr/bin/zsh
echo 'Commencing Feierabend'
git stash
git switch main
git stash pop
git commit -a -m 'Feierabend'
git push --force origin main
/usr/bin/expect -c "spawn fab production deploy; expect 'out: sudo password:'; send 'dieRuthbacktsogut';"
echo 'Feierabend accomplished'
@Samuirai
Samuirai / sudoku.py
Created June 21, 2012 23:04
Sudoku
# This code should solve any Sudoku
# 1. The algorithm first tries direct decidable fields (with only one possible value)
# 2. If there are only fields left with multiple possible values, it will make a recursive call with each possible value
# 3. PROFIT!
import copy
# solveable
grid = [[3,0,0, 2,4,0, 0,6,0],
[0,4,0, 0,0,0, 0,5,3],
@benjchristensen
benjchristensen / index.html
Last active December 7, 2023 13:39
Interactive Line Graph (D3)
<!--
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@sma
sma / markdown_to_bbcode.py
Created December 23, 2011 11:26
Converts a subset of markdown into BBcode
import re
def markdown_to_bbcode(s):
links = {}
codes = []
def gather_link(m):
links[m.group(1)]=m.group(2); return ""
def replace_link(m):
return "[url=%s]%s[/url]" % (links[m.group(2) or m.group(1)], m.group(1))
def gather_code(m):
@dokterbob
dokterbob / validators.py
Created August 31, 2011 15:03
Validator for files, checking the size, extension and mimetype.
from os.path import splitext
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat
class FileValidator(object):
"""
Validator for files, checking the size, extension and mimetype.
from flask import Module, request, redirect, url_for, render_template, abort
from formalchemy import FieldSet
from example import db
from example import Service, User, Forum, Category, Topic, Post
mod = Module(__name__)
models = {