This file contains hidden or 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 re | |
| from django.utils.text import compress_string | |
| from django.utils.cache import patch_vary_headers | |
| from django import http | |
| try: | |
| import settings | |
| XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS |
This file contains hidden or 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
| (function($){ | |
| ListFilterCollapsePrototype = { | |
| bindToggle: function(){ | |
| var that = this; | |
| this.$filterTitle.click(function(){ | |
| that.$filterContent.slideToggle(); | |
| that.$list.toggleClass('filtered'); | |
| }); | |
| }, | |
| init: function(filterEl) { |
This file contains hidden or 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
| from django.contrib import admin | |
| class ReadOnlyModelAdmin(admin.ModelAdmin): | |
| """ | |
| ModelAdmin class that prevents modifications through the admin. | |
| The changelist and the detail view work, but a 403 is returned | |
| if one actually tries to edit an object. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import os | |
| import subprocess | |
| # > python subprocessdemote.py | |
| # > sudo python subprocessdemote.py | |
| def check_username(): |
This file contains hidden or 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
| # coding: utf-8 | |
| require 'rghost' | |
| require 'rghost_barcode' | |
| require 'thinreports' | |
| RGhost::Config::GS[:path] = '/usr/local/bin/gs' | |
| bar = RGhost::Document.new :paper => ['10 cm', '1 cm'] | |
| bar.barcode_japanpost '26300233-30-8-403', |
This file contains hidden or 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
| $(function () { | |
| "use strict"; | |
| // for better performance - to avoid searching in DOM | |
| var content = $('#content'); | |
| var input = $('#input'); | |
| var status = $('#status'); | |
| // my color assigned by the server | |
| var myColor = false; |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
| <title>Chronological Diagram of Asia</title> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
| <style type="text/css"> | |
| .chart { | |
| shape-rendering: crispEdges; | |
| } |
This file contains hidden or 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/sh | |
| # concurrency is hard, let's have a beer | |
| MAX_PROCS=4 | |
| parallel_provision() { | |
| while read box; do | |
| echo "Provisioning '$box'. Output will be in: $box.out.txt" 1>&2 | |
| echo $box |
This file contains hidden or 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
| /* | |
| * First create the keystore (to allow SSL protection) by importing the LDAP | |
| * certificate (cert.pem) with: | |
| * keytool -import -keystore keystore -storepass changeit -noprompt -file cert.pem | |
| * | |
| * You can get the certificate with OpenSSL: | |
| * openssl s_client -connect ldap.server.com:636 </dev/null 2>/dev/null | sed -n '/^-----BEGIN/,/^-----END/ { p }' > cert.pem | |
| * | |
| * Then compile this class with: | |
| * javac LdapAuth.java |
This file contains hidden or 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
| private boolean isServiceRunning() { | |
| ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); | |
| for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)){ | |
| if("com.example.MyNeatoIntentService".equals(service.service.getClassName())) { | |
| return true; | |
| } | |
| } | |
| return false; | |
| } |
OlderNewer