pip3 install --user pyqt5
sudo apt-get install python3-pyqt5
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools
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 csv | |
import urllib.request | |
from bs4 import BeautifulSoup | |
BASE_URL = 'http://www.weblancer.net/projects/' |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Draggable</title> | |
<style> | |
.draggable { | |
position: absolute; |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
// Immutable Shuffle | |
const shuffleImmutable = (arr) => arr.slice().sort(() => Math.random() - 0.5) | |
// Random number in range | |
const randomInRange = (from, to) => Math.floor(from + Math.random() * (to - from + 1)) | |
// Array with unique items | |
const uniqueItems = (arr) => [...new Set(arr)] | |
// Uppercase firs letter |
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
function convertToWebp(string $src, int $quality = 100): string | |
{ | |
$dir = pathinfo($src, PATHINFO_DIRNAME); | |
$name = pathinfo($src, PATHINFO_FILENAME); | |
$ext = pathinfo($src, PATHINFO_EXTENSION); | |
$dest = "$dir/{$name}_$ext.webp"; | |
$is_alpha = false; | |
switch (mime_content_type($src)) { |
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
export function ab2str(buf) | |
{ | |
return String.fromCharCode.apply(null, new Uint16Array(buf)) | |
} |
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
export function str2ab(str) | |
{ | |
let buf = new ArrayBuffer(str.length * 2) // 2 bytes for each char | |
let bufView = new Uint16Array(buf) | |
for (let i = 0, strLen = str.length; i < strLen; i++) { | |
bufView[i] = str.charCodeAt(i) | |
} | |
return buf |
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
export class AsyncArray extends Array | |
{ | |
[Symbol.asyncIterator]() | |
{ | |
let i = 0 | |
return { | |
next: () => new Promise(resolve => { | |
setTimeout(() => resolve({ value: this[i], done: i++ === this.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
Object.defineProperty(Array.prototype, 'binarySearch', { | |
value(target, comparator) { | |
let l = 0, | |
h = this.length - 1, | |
m, comparison | |
/* default comparison method if one was not provided */ | |
comparator = comparator || function(a, b) { | |
return (a < b ? -1 : (a > b ? 1 : 0)) | |
} |
OlderNewer