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
| varnishlog -i TxStatus,RxURL -I '503|.*' |
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 FUNCTION gai_do_refresh_reputation_desc_album_community_stacked(INTEGER DEFAULT NULL, INTEGER DEFAULT NULL) RETURNS BOOLEAN AS $$ | |
| DECLARE | |
| lock RECORD; | |
| BEGIN | |
| --Lock | |
| SELECT id | |
| FROM object_display_order_types | |
| WHERE id = get_object_display_order_type('reputation_desc', get_huddler_constant('CONTENT_TYPE_GALLERY_ALBUM')::integer) | |
| INTO lock FOR UPDATE; |
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/ruby | |
| require 'rubygems' | |
| require 'beaneater' | |
| require 'json' | |
| module Enumerable | |
| def sum | |
| return self.inject(0){|acc,i|acc +i} | |
| end |
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
| SELECT external_store_objects.id, | 00:05:41.558663 | |
| COALESCE(original_filename, SUBSTRING(local_key FROM '[^/]+$')) AS path, | |
| external_store_objects.uploaded_on, | |
| gallery_images.id AS gallery_images_id, | |
| gallery_images.description, | |
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
| /*gcc -o t-poller t-poller.c -lpthread*/#include <stdio.h>#include <stdlib.h>#include <string.h> | |
| #include <unistd.h> | |
| #include <poll.h> | |
| #include <pthread.h> | |
| #include <sys/time.h> | |
| #include <sys/resource.h> | |
| #define THREADS 1000 | |
| #define ITERATIONS 1000 | |
| void * child(void * ptr) |
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
| /* | |
| * Exercise the poll() on a shared pipe() context switching issue on Linux using threads. Original code taken from | |
| * http://lkml.indiana.edu/hypermail/linux/kernel/1012.1/03515.html and modified to use threads. | |
| * | |
| * On older 2.6 Linux kernels running this program will drive context switches per second up near 1M/s. | |
| * On 3.x kernels you will see the csw/s pushed up to ~12k depending on the current process load. | |
| * | |
| * gcc -o t-poller t-poller.c -lpthread | |
| */ | |
| #include <stdio.h> |
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
| BEGIN; | |
| CREATE TABLE order_by_test ( | |
| id SERIAL PRIMARY KEY, | |
| token INTEGER NOT NULL | |
| ); | |
| INSERT INTO order_by_test(token) | |
| SELECT id | |
| FROM generate_series(1,10) AS id; |
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
| boltzmann <- function(x, t=0.1) { exp(x/t) / sum(exp(x/t)) } | |
| x=rnorm(10,mean=1,sd=0.5) | |
| plot(boltzmann(x)) | |
| lines(boltzmann(x)) |
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
| ELETE FROM subjects | |
| WHERE context_id IN ( | |
| SELECT context_id | |
| FROM contexts | |
| WHERE key like 'c.30.%' | |
| AND cmty_id = 120 | |
| ); | |
| DELETE | |
| FROM contexts |
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 'rubygems' | |
| require 'beaneater' | |
| require 'json' | |
| require 'pp' | |
| beanstalk = Beaneater::Pool.new(['localhost:11300']) | |
| tube = beanstalk.tubes["huddlerXheadfi.BasicObject"] | |
| (0..1000).each do |i| | |
| break if not tube.peek(:ready) |