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 round(avg(t1.LAT_N), 4) as median_val | |
FROM ( | |
SELECT @rownum := @rownum+1 as `row_number`, | |
s.LAT_N | |
FROM STATION s, | |
(SELECT @rownum := 0) r | |
ORDER BY s.LAT_N | |
) as t1, | |
( | |
SELECT count(*) as total_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
DELIMITER $$ | |
DROP PROCEDURE IF EXISTS prime $$ | |
CREATE PROCEDURE prime (n INT, OUT res varchar(8000)) | |
BEGIN | |
DECLARE i smallint DEFAULT 2; | |
DECLARE j smallint; | |
DECLARE isPrime bit; | |
DECLARE result varchar(8000) DEFAULT ''; |
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
<?php | |
$hash = '<hash goes here>'; | |
$pass = '<password goes here>'; | |
$hash = password_hash($pass, PASSWORD_BCRYPT); | |
echo $hash; | |
if (password_verify($pass, $hash)) { | |
echo 'Password is valid!'; | |
} else { |
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
php -r 'while($code = fgets(STDIN)) { echo base_convert($code, 36, 10) . "\n"; }' |
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
public class Animal<T> { | |
public T animal; | |
public void setAnimal(T animal) { | |
this.animal = animal; | |
} | |
public T get() { | |
return animal; |
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 retry(howmany): | |
def tryIt(func): | |
def f(): | |
attempts = 0 | |
while attempts < howmany: | |
try: | |
return func() | |
except: | |
attempts += 1 | |
return f |
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
/* | |
* Copyright (C) 2008 The Android Open Source Project | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* * Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* * Redistributions in binary form must reproduce the above copyright |
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 <iostream> | |
using namespace std; | |
namespace X { struct F { static void f() { cout << __PRETTY_FUNCTION__; } }; } | |
// Clang: static void X::F::f() | |
// GCC: static void X::F::f() | |
int main() { X::F::f(); } |
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
Foreword | |
As is well known at this point, I created JavaScript in ten days in May | |
1995, under duress and conflicting management imperatives—“make | |
it look like Java,” “make it easy for beginners,” “make it control almost | |
everything in the Netscape browser.” | |
Apart from getting two big things right (first-class functions, object | |
prototypes), my solution to the challenging requirements and crazy- | |
short schedule was to make JavaScript extremely malleable from | |
the start. I knew developers would have to “patch” the first few ver- |
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
#!/usr/bin/env bash | |
sudo apt-get install libncursesw5-dev && ./autogen.sh && ./configure --prefix=$HOME && make -j$(nproc) && make -j$(nproc) install |