Skip to content

Instantly share code, notes, and snippets.

@silviot
silviot / flextextarea.js
Created October 17, 2011 12:55
Ext.ux.FlexTextArea: textarea field that adjusts its height to fit the text in it
// Tested with ExtJS 3.2.0
Ext.ux.FlexTextArea = Ext.extend(Ext.form.TextArea, {
maxHeight : 300, // don't grow beyond this point
minHeight : 30, // don't shrink below this height
growBy: 20, // size the textarea to leave this space blank
initComponent : function() {
Ext.ux.FlexTextArea.superclass.initComponent.call(this);
if (!this.rendered) {
this.addListener('render', this.createHelperElement, this);
} else {
@silviot
silviot / buildout-redmine.cfg
Created January 3, 2012 00:19
Redmine 1.3.0 installation buildout
[buildout]
parts =
rubygems
redmine
redmine-config
redmine-database
var
redmine-session-initialize
swap-data-dirs
"""
I have a challenge for you:
- Print "Hello World" using any language.
- Each character must be printed from its own, unique thread
That's it. Obviously, as there's no guarantee that the threads will operate in the order you start them, you have to make your program thread safe to ensure the output is printed in the right order.
And, because this is code golf, the shortest program wins.
Source: http://codegolf.stackexchange.com/questions/5871/helolw-rdlo-a-threading-challenge
Ext.define('RIP.LabeledSlider',{
/* A slider that shows its value next to it*/
extend: 'Ext.field.Slider',
xtype: 'labeledslider',
updateToolTip: function() {
this.valuediv.innerHTML = this.getValue();
},
reset: function() {
this.callParent(arguments);
this.updateToolTip();
<plominodatabase id="multi">
<design>
<dbsettings version="1.16">
<AboutDescription type="Products.Archetypes.Field.TextField"><![CDATA[<p><br mce_bogus="1"></p>]]></AboutDescription>
<UsingDescription type="Products.Archetypes.Field.TextField"><![CDATA[<p><br mce_bogus="1"></p>]]></UsingDescription>
<IndexAttachments type="Products.Archetypes.Field.BooleanField">False</IndexAttachments>
<FulltextIndex type="Products.Archetypes.Field.BooleanField">True</FulltextIndex>
<IndexInPortal type="Products.Archetypes.Field.BooleanField">False</IndexInPortal>
<debugMode type="Products.Archetypes.Field.BooleanField">False</debugMode>
<StorageAttachments type="Products.Archetypes.Field.BooleanField">False</StorageAttachments>
"""
Use with
bin/instance run export_skin_folder.py
This script will extract the portal_skins folder
named in SKINFODLER_NAME to the DEST directory
"""
import os
import sys
PLONE_PORTAL = 'Plone'
@silviot
silviot / gist:6794863
Created October 2, 2013 14:44
SublimeText import/export python script
#!/bin/env
"""
Import / export sublime config settings.
"""
import os
from subprocess import check_output
HOME_SUBL = os.path.expanduser("~/.config/sublime-text-3/Packages/User")
@silviot
silviot / es_status.sh
Last active February 16, 2016 12:38
Elasticsearch zabbix External check script
#!/bin/bash
HOST=$1
METRIC=$2
if [ "x$HOST" = "x" ] || [ "x$METRIC" = "x" ]; then
exit 1
fi
curl "http://$HOST:9200/_cluster/health?format=yaml&pretty=1" 2> /dev/null | grep $METRIC | cut -f2 -d ' ' | sed -e 's/"//g'
#!/usr/bin/env python
from dns import resolver # dnspython
from dns import reversename
from dns import rdatatype
from ntplib import NTPClient # ntplib
from ntplib import NTPException
NTP_NAME = '0.europe.pool.ntp.org'
NTP_NAME = '0.us.pool.ntp.org'
@silviot
silviot / reboot.yml
Last active May 9, 2018 07:46
Reboot server and wait for restart with ansible
# After way too many attempts, this one seems to really work all the time
- name: Reboot server
shell: sleep 2 && reboot
async: 1
poll: 0
failed_when: false
become: true
- name: Wait for server to initiate shutdown