This file contains 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 random_rows(db, model, columns={}, num=100): | |
column_types = [ {'name': col.name, 'type': str(col.type)} for col in model.__table__.columns] | |
rows = [] | |
for n in range(1, num): | |
rows.append([random.choice(columns.get(col['name']) or [None]) or __random_data(col['type']) for col in column_types]) | |
return rows | |
This file contains 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 random_rows(db, model, columns={}, num=100): | |
column_types = [ {'name': col.name, 'type': str(col.type)} for col in model.__table__.columns] | |
rows = [] | |
for n in range(1, num): | |
rows.append([random.choice(columns.get(col['name']) or [None]) or __random_data(col['type']) for col in column_types]) | |
return rows | |
This file contains 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 random_rows(db, model, columns={}, num=100): | |
column_types = [ {'name': col.name, 'type': str(col.type)} for col in model.__table__.columns] | |
rows = [] | |
for n in range(1, num): | |
rows.append([random.choice(columns.get(col['name']) or [None]) or __random_data(col['type']) for col in column_types]) | |
return rows | |
This file contains 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 Parent { | |
has Str $.title = "Yay Parent Default"; | |
} | |
class Child is Parent { | |
has Int $.index = 10; | |
} | |
class Baby is Child { | |
has Rat $.weight = 1/10; |
This file contains 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
$ zef install WWW | |
===> Searching for: WWW | |
===> Updated cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan.json | |
===> Updated p6c mirror: http://ecosystem-api.p6c.org/projects.json | |
===> Searching for missing dependencies: HTTP::UserAgent, IO::Socket::SSL, Test::When | |
===> Searching for missing dependencies: DateTime::Parse, Encode, IO::Capture::Simple, Test::Util::ServerPort, OpenSSL | |
===> Testing: DateTime::Parse:ver('0.0.1') | |
===> Testing [OK] for DateTime::Parse:ver('0.0.1') | |
===> Testing: Encode:ver('0.0.2'):auth('github:sergot') | |
===> Testing [OK] for Encode:ver('0.0.2'):auth('github:sergot') |
This file contains 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
sub help { | |
say "help me!"; | |
} | |
multi sub MAIN('help') { | |
help() | |
} | |
multi sub MAIN(:$help) { |
This file contains 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 proxyon { | |
sudo networksetup -setwebproxy Wi-Fi localhost 8080 | |
sudo networksetup -setsecurewebproxy Wi-Fi localhost 8080 | |
sudo networksetup -setwebproxystate Wi-Fi on | |
sudo networksetup -setsecurewebproxystate Wi-Fi on | |
ssh -2CnNqT -L 8080:wwwcache.server.com:8080 user@bastion.host | |
} | |
function proxyoff { | |
sudo networksetup -setwebproxystate Wi-Fi off |
This file contains 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
#include "DigiKeyboard.h" | |
//Command key is ord 37 and as a modifier 0x00000008 | |
//See NX_DEVICELCMDKEYMASK http://svn.red-bean.com/bob/SDL-altivec/trunk/src/video/quartz/SDL_QuartzEvents.m | |
//For a look at available keys https://github.com/digistump/DigisparkArduinoIntegration/blob/master/libraries/DigisparkKeyboard/DigiKeyboard.h | |
#define MOD_CMD_LEFT 0x00000008 | |
boolean do_hack = true; | |
void setup() { |
This file contains 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
my class 2bit does Blob[uint8] is repr('VMArray') { | |
method decode(2bit:D: $encoding = '2bit') { | |
die "Can not decode a 2bit buffer as if it were $encoding" | |
unless $enc eq '2bit'; | |
#TODO the guts here | |
} | |
method encoding() { '2bit' } | |
multi method Str(2bit:D:) { self.decode } | |
multi method Stringy(2bit:D:) { self.decode } | |
} |
This file contains 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 g.gene_id, s.synonym AS hgnc_symbol, GROUP_CONCAT(ga.value ORDER BY attrib_type_id DESC) AS ensembl_name_synonym, sr.name AS chr, g.seq_region_start AS start, g.seq_region_end AS end | |
FROM gene AS g | |
JOIN seq_region AS sr ON g.seq_region_id = sr.seq_region_id | |
JOIN gene_attrib AS ga ON g.gene_id = ga.gene_id AND attrib_type_id IN (3,4) | |
JOIN object_xref AS ox ON g.gene_id = ox.ensembl_id AND ox.ensembl_object_type='Gene' | |
JOIN xref AS x ON ox.xref_id = x.xref_id | |
JOIN external_synonym AS s ON x.xref_id = s.xref_id | |
JOIN external_db AS d ON d.external_db_id = x.external_db_id AND d.db_name = 'HGNC' | |
WHERE s.synonym LIKE 'ITPR1' OR ga.value LIKE 'ITPR1' | |
GROUP BY g.gene_id; |