Skip to content

Instantly share code, notes, and snippets.

View sorki's full-sized avatar
🦊
Tying the Knots

Sorki sorki

🦊
Tying the Knots
View GitHub Profile
Circle of Despair
Righteous War
#include<vector>
#include<iterator>
//#include "exceptions.h"
using namespace std;
template <class I, class T>
class SparseArray {
private:
vector<pair<I, T> > values;
bool exists(I position);
From c34aa1bc6858bffc1d3db0470e4f33c4428f6c31 Mon Sep 17 00:00:00 2001
From: Richard Marko <rissko@gmail.com>
Date: Thu, 15 Jul 2010 16:16:56 +0200
Subject: [PATCH] Convert css class of PasswordInput widget
---
uni_form/templatetags/uni_form_field.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/uni_form/templatetags/uni_form_field.py b/uni_form/templatetags/uni_form_field.py
def custom_create(request, *args, **kwargs):
''' update __init__ of the form class to use current user as initial '''
form_class = kwargs['form_class']
class custom_class(form_class):
def __init__(self, *args, **kwargs):
kwargs['initial'] = {'user': request.user.id}
return super(custom_class, self).__init__(*args, **kwargs)
kwargs['form_class'] = custom_class
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; General Options ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Specify a file into which sidc will write messages. This file is written
; using open/append/close, so that you can apply a straightforward log rotate
; policy
logfile /data/projects/sid/sidc/sidc.log
; Specify a directory to contain output data files. Use '.' for the
<?php
$txt = 'abcd ***animation(text1|text2) defg ***animation(txt1|txt2)';
function replace_anim($matches) {
return '[[Replaced: 1-"'.$matches[1].'"-2-"'.$matches[2].'"]]';
}
$ret = preg_replace_callback('~\*\*\*animation\(([^|]+)\|([^|]+)\)~', "replace_anim", $txt);
echo $ret;
?>
@sorki
sorki / .pronsolerc-rostock
Created September 12, 2013 14:17
~/.pronsolerc-rostock used for rostock calibration pronterface.py -c ~/.pronsolerc-rostock
set sliceoptscommand deslicer_pronterface_cfg
set slicecommand deslicer_pronterface $s $o
set port /dev/ttyUSB0
set baudrate 250000
set last_bed_temperature 105.0
set last_temperature 195.0
set xy_feedrate 3000
set z_feedrate 3000
set e_feedrate 50
yumParser :: Parser [YumMsg]
yumParser = (many $ yumEntryParser <* endOfLine)
yumEntryParser =
Separator <$> takeWhile (=='=')
-- Separator <$> string "==="
<|> Message <$> takeTill isEndOfLine
@sorki
sorki / wp_check_update.sh
Created November 6, 2016 12:59
Wordpress update checker
#!/bin/bash
WP_DIR=/var/www/<FIXME>
/usr/local/bin/wp --path=$WP_DIR core check-update --quiet
if [ "$?" != "0" ]; then
Wordpress update required
/usr/local/bin/wp --path=$BLOG_DIR core check-update
fi
@sorki
sorki / wp_check_update
Last active November 16, 2017 21:13
wordpress check / update with wp-cli
# for crontab. e.g.:
# 5 5 * * * /root/bin/wp_check_update
BLOG_DIR=/var/www/<INSERT_BLOG_PATH>
wp --path=$BLOG_DIR core check-update --quiet
if [ "$?" != "0" ]; then
Wordpress update required
wp --path=$BLOG_DIR core check-update
fi