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
| require('luarocks.require') | |
| require('md5') | |
| require('Memcached') | |
| local memcache = Memcached.Connect() | |
| cache_hits = 0 | |
| cache_misses = 0 | |
| function is_query(packet) | |
| return packet:byte() == proxy.COM_QUERY |
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
| class Lazy(type): | |
| def __init__(cls, name, bases, dict): | |
| super(Lazy, cls).__init__(name, bases, dict) | |
| cls.instance = None | |
| def check_instance(cls): | |
| if cls.instance is None: | |
| if hasattr(cls, 'instantiate'): | |
| setattr(cls, 'instance', getattr(cls, 'instantiate')()) | |
| else: |
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
| def get_db(): | |
| db = getattr(get_db, 'db', db_connection()) | |
| get_db.db = db | |
| return db | |
| def func1(): | |
| db = get_db() | |
| db.execute('SELECT * FROM things') | |
| def func2(): |
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 Image | |
| from numpy import average, linalg, dot | |
| import sys | |
| images = sys.argv[1:3] | |
| vectors = [] | |
| norms = [] | |
| for image in images: | |
| vector = [] |
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
| source :idx, | |
| { | |
| :file => 'listings.txt', | |
| :parser => :delimited, | |
| :skip_lines => 1 | |
| }, | |
| [ | |
| :listing_id, | |
| :area, | |
| :baths_full, |
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
| Header "%% Erliki". | |
| Nonterminals phrase wikilink word. | |
| Terminals string '[[' ']]' '<' '>'. | |
| Rootsymbol phrase. | |
| phrase -> word : '$1'. | |
| phrase -> word phrase : ['$1', '$2']. | |
| wikilink -> '[[' string ']]' : {'wikilink', '$2'}. | |
| word -> wikilink : '$1'. | |
| word -> string : '$1'. |
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/bash | |
| HOST=127.0.0.1 | |
| PORT=1978 | |
| SID=1 | |
| UPDATE_LOG_DIR=ulog/$SID | |
| MASTER_HOST=127.0.0.1 | |
| MASTER_PORT=1979 | |
| mkdir -p $UPDATE_LOG_DIR |
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
| $clock.bpm = 80 | |
| $mutation = L{|measure| true} | |
| $measures = 4 | |
| def note(midi_note_number) | |
| Note.create(:channel => 2, | |
| :number => midi_note_number, | |
| :duration => 1, | |
| :velocity => 100 + rand(27)) |
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
| require 'java' | |
| require 'jar-that-has-my-libaries.jar' | |
| import com.what.DeserializationUtil | |
| util = DeserializationUtil.new() | |
| puts util.inspect |
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
| -- I want my code to be backwards compatible with database versions | |
| SELECT COUNT(*) | |
| INTO has_new_col | |
| FROM all_tab_cols | |
| WHERE table_name = 'UPDATED_TABLE' | |
| AND column_name = 'NEW_COL'; | |
| IF has_new_col = 0 THEN | |
| INSERT INTO other_table |
OlderNewer