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
| @org.junit.Test | |
| public void testClasses() { | |
| class A { | |
| } | |
| A a = new A(); | |
| assertEquals(a, a); | |
| assertTrue(new A[]{a, a, a}.equals(new A[]{a, a, a})); | |
| assertEquals(new A(), new A()); |
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
| package com.company; | |
| import java.io.*; | |
| import java.nio.charset.Charset; | |
| public class Main { | |
| public static byte[] to1251Bytes(final String str) { | |
| try { | |
| final ByteArrayOutputStream os = new ByteArrayOutputStream(str.length()); |
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/env bash | |
| echo "CREATE TABLE lines (line TEXT);"; | |
| while read line; do | |
| escaped=${line//\'/\'\'}; | |
| echo "INSERT INTO lines VALUES ('$escaped');"; | |
| done |
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/awk -f | |
| # Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
| # CREATE block and create them in separate commands _after_ all the INSERTs. | |
| # Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
| # The mysqldump file is traversed only once. | |
| # Usage: $ ./mysql2sqlite.awk < db-mysql.sql | sqlite3 database.sqlite | |
| # Example: $ mysqldump --no-data -u root -pMySecretPassWord myDbase | ./mysql2sqlite.awk | sqlite3 database.sqlite |
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 http = require('http'); | |
| var uparse = require('url').parse; | |
| http.createServer(function ({url}, res) { | |
| const {headerCharset, responseText, htmlCharset} = uparse(url, true).query; | |
| const ctype = 'text/html' + (headerCharset ? '; charset=' + headerCharset : ''); | |
| res.writeHead(200, {'Content-Type': ctype}); | |
| const meta = htmlCharset ? `<meta charset="${htmlCharset}">` : ``; | |
| res.end(`<!doctype html> | |
| <html> |
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 Data.Maybe | |
| import Data.List | |
| import Data.Ord | |
| data DicTrie = DicTrie [(Char, DicTrie)] deriving Show | |
| emptyTrie = DicTrie [] | |
| mainDict = DicTrie [ | |
| ('e', DicTrie[ | |
| ('n', DicTrie[ |
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/env python3 | |
| from collections import Counter | |
| import numpy as np | |
| import pickle | |
| MAX_COUNTER_SIZE = 2**16 | |
| MAX_SEQ_SIZE = 16 | |
| MAX_SIMILARITY = .75 |
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/env python3 | |
| import pandas as pd | |
| import numpy as np | |
| import sys | |
| import logging | |
| def is_valid_line(line: bytes): | |
| return line and b"SQLProxy" not in line and b"P2_COD" not in line |
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
| #version: 0.2 | |
| e s</w> | |
| d e</w> | |
| e n | |
| a n | |
| o n | |
| t i | |
| l e</w> | |
| o u | |
| e s |
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 TABLE SUBJECT1 ( | |
| NAME VARCHAR(100), | |
| SURNAME VARCHAR(100), | |
| CITY VARCHAR(100) | |
| ); | |
| INSERT INTO SUBJECT1 | |
| SELECT NAME, SURNAME, CITY | |
| FROM SUBJECT | |
| GROUP BY NAME, SURNAME, CITY; |