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
is_prime_array = [False, True, True, True, False] | |
primes = [1, 2, 3, 5] | |
def is_prime(n): | |
if n <= 3: | |
return True | |
if n % 2 == 0 or n % 3 == 0: | |
return False | |
i = 5 | |
while i * i <= 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
using System; | |
struct StructSetter | |
{ | |
public int Result; | |
public void Set(int value) => Result = value; | |
} | |
class ClassSetter |
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
DROP FUNCTION create_btree_index; | |
CREATE OR REPLACE FUNCTION create_btree_index(schema_name text, table_name text, column_name text) RETURNS void | |
AS $$ | |
BEGIN | |
EXECUTE 'CREATE INDEX IF NOT EXISTS ' || table_name || '__' || column_name || '_btree ON ' || schema_name || '.' || table_name || ' USING btree (' || column_name || ');'; | |
END; | |
$$ LANGUAGE plpgsql; | |
DROP FUNCTION create_btree_indexes_for_all_columns; |
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
#!/bin/bash | |
ACCESS_TOKEN=`cat access-token` | |
while : | |
do | |
curl "https://api.vk.com/method/execute.acceptAllFriendRequests?access_token=${ACCESS_TOKEN}&v=5.131" | |
printf "\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
#include <iostream> | |
#include <tuple> | |
#include <functional> | |
#define THIS_REFERENCE_WRAPPER_METHODS(MethodName, TWrapped) \ | |
constexpr auto&& MethodName() & { return static_cast<TWrapped&>(*this); } \ | |
constexpr auto&& MethodName() && { return static_cast<TWrapped&&>(*this); } \ | |
constexpr auto&& MethodName() const & { return static_cast<const TWrapped&>(*this); } \ | |
constexpr auto&& MethodName() const && { return static_cast<const TWrapped&&>(*this); } |
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 c.table_schema, c.table_name, c.column_name | |
FROM (SELECT * FROM | |
information_schema.tables) As t INNER JOIN | |
(SELECT * FROM information_schema.columns) c | |
ON (t.table_name = c.table_name AND t.table_schema = c.table_schema) | |
LEFT JOIN pg_catalog.pg_indexes i ON | |
(i.tablename = c.table_name AND i.schemaname = c.table_schema | |
AND indexdef LIKE '%' || c.column_name || '%') | |
WHERE i.tablename IS NULL AND c.table_schema = 'public' AND c.table_name = 'nodes' | |
ORDER BY c.table_schema, c.table_name; |
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
var requests = API.friends.getRequests().items; | |
var i = 0; | |
while(i < requests.length) | |
{ | |
API.friends.add({ user_id: requests[i] }); | |
i = i + 1; | |
} | |
return requests; |
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
sudo docker run -d --restart unless-stopped --stop-timeout 300 -p 28967:28967 -p 192.168.1.74:14002:14002 -e WALLET="0x102c4f1957484E3cf5507B115cFa9fB47da7862A" -e EMAIL="[email protected]" -e ADDRESS="konard.ddns.net:28967" -e STORAGE="500GB" --mount type=bind,source="/mnt/usb-Seagate_BUP_Slim_BL_NA7LAG1K-0:0-part2/identity/storagenode",destination=/app/identity --mount type=bind,source="/mnt/usb-Seagate_BUP_Slim_BL_NA7LAG1K-0:0-part2/storj",destination=/app/config --name storagenode storjlabs/storagenode:latest |
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 equal(a, b) { return (a >= b) && (a <= b); } |
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
{"contents":{"editor":{"tabSize":2},"launch":{"version":"0.2.0","configurations":[{"type":"chrome","request":"launch","name":"Meteor: Chrome","url":"http://localhost:3000","webRoot":"${workspaceFolder}"},{"type":"node","request":"launch","name":"Meteor: Node","runtimeExecutable":"npm","runtimeArgs":["run","debug"],"port":9229,"timeout":999999,"console":"integratedTerminal"}]}},"overrides":[],"keys":["editor.tabSize","launch.version","launch.configurations"]} |