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
| DELETE FROM table USING same_table an_alias | |
| WHERE table.field1 = an_alias.field1 AND table.field2 = an_alias.field2 | |
| AND | |
| -- this condition determines which of the duplicates will be eliminated | |
| table.max_field < an_alias.max_field |
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
| CREATE OR REPLACE FUNCTION insta5.next_id(OUT result bigint) AS $$ | |
| DECLARE | |
| our_epoch bigint := 1314220021721; | |
| seq_id bigint; | |
| now_millis bigint; | |
| shard_id int := 5; | |
| BEGIN | |
| SELECT nextval('insta5.table_id_seq') %% 1024 INTO seq_id; | |
| SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO now_millis; |
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
| with self.settings(LOGIN_URL='/other/login/'): |
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 logging | |
| from logging.config import dictConfig | |
| from logsettings import LOG_SETTINGS | |
| dictConfig(LOG_SETTINGS) | |
| logger = logging.getLogger('reservation.requests') | |
| logger.setLevel(logging.DEBUG) |
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
| $(document).ready(function() { | |
| // Handler for .ready() called. | |
| }); |
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
| DIR="/etc" | |
| if [ -d $DIR ]; then | |
| echo "Folder ${DIR} exists" | |
| else | |
| echo "Folder ${DIR} does NOT exists" | |
| fi |
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
| # find files accessed in the last 7 days | |
| find . -type f -atime -7 -print | |
| # file files greater than 2k | |
| find . -type f -size +2k | |
| #File size specifiers | |
| #b 512 byte blocks | |
| #c bytes | |
| #w two byte words | |
| #k Kilobyte |
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
| var videoElement = document.getElementById("myvideo"); | |
| function toggleFullScreen() { | |
| if (!document.mozFullScreen && !document.webkitFullScreen) { | |
| if (videoElement.mozRequestFullScreen) { | |
| videoElement.mozRequestFullScreen(); | |
| } else { | |
| videoElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); | |
| } |
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
| dialect+driver://user:password@host/dbname[?key=value..] | |
| engine = create_engine('postgresql+psycopg2://scott:tiger@localhost/mydatabase') | |
| engine = create_engine('sqlite:///foo.db') |
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
| # Author: Jacob Kristhammar, 2010 | |
| # | |
| # Updated version of websocket.py[1] that implements latest[2] stable version | |
| # of the websocket protocol. | |
| # | |
| # NB. It's no longer possible to manually select which callback that should | |
| # be invoked upon message reception. Instead you must override the | |
| # on_message(message) method to handle incoming messsages. | |
| # This also means that you don't have to explicitly invoke | |
| # receive_message, in fact you shouldn't. |