Skip to content

Instantly share code, notes, and snippets.

View kostasx's full-sized avatar
💭
Uncaught ReferenceError

Kostas Minaidis kostasx

💭
Uncaught ReferenceError
View GitHub Profile
@kostasx
kostasx / ytdl-progress.js
Last active April 8, 2022 10:56
Download YouTube videos with progress bar using Node.js
var ytdl = require('ytdl-core');
var fs = require('fs');
var bar;
ytdl( "https://www.youtube.com/watch?v=EuwrDCng1Dc" )
.on('response', function(res){
var ProgressBar = require('progress');
bar = new ProgressBar('downloading [:bar] :percent :etas', {
@kostasx
kostasx / php2js-curl-basic-auth.js
Last active February 7, 2022 23:08
PHP to Node.js: cURL with Basic Authentication
/*
<?php
// THE FOLLOWING IMPLEMENTATION CAN BE USED FOR VARIOUS APIs. THIS WAS TESTED SUCCESSFULLY ON THE pingdom.com API
$email = "your@mail.net";
$passwd = 'password';
$api_key = "API_KEY";
$curl = curl_init();
@kostasx
kostasx / erc721-example.sol
Created November 23, 2021 21:39 — forked from aunyks/erc721-example.sol
My implementation of the ERC721 token standard. WARNING: THIS CODE IS FOR EDUCATIONAL PURPOSES. DO NOT DEPLOY TO THE NETWORK.
pragma solidity ^0.4.19;
contract ERC721 {
string constant private tokenName = "My ERC721 Token";
string constant private tokenSymbol = "MET";
uint256 constant private totalTokens = 1000000;
mapping(address => uint) private balances;
mapping(uint256 => address) private tokenOwners;
mapping(uint256 => bool) private tokenExists;
mapping(address => mapping (address => uint256)) private allowed;
mapping(address => mapping(uint256 => uint256)) private ownerTokens;
contract ERC721 {
// ERC20 compatible functions
function name() constant returns (string name);
function symbol() constant returns (string symbol);
function totalSupply() constant returns (uint256 totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
// Functions that define ownership
function ownerOf(uint256 _tokenId) constant returns (address owner);
function approve(address _to, uint256 _tokenId);
function takeOwnership(uint256 _tokenId);
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551
@kostasx
kostasx / _tsne.pdf
Created February 28, 2021 17:36 — forked from kylemcdonald/_tsne.pdf
Exploring antonyms with word2vec.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"embeddings": [
{
"tensorName": "Reviews Sentiment Analysis Vector Space",
"tensorShape": [
1000,
50
],
"tensorPath": "https://gist.githubusercontent.com/kostasx/0af4f6303ff6821476543366904e4b21/raw/1357a73b5a75fbb8d49646b471a9d19470d9238e/embedding-projector--vecs.tsv",
"metadataPath": "https://gist.githubusercontent.com/kostasx/8aa6c86651ca73d0455d546c8b2a078e/raw/61dceae3f45fd1abf7eb16964c2f92fda30ac464/embedding-projector--meta.tsv"
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 16 columns, instead of 8. in line 5.
0.11199197 -0.003564898 0.28838375 -0.02453965 -0.060024902 -0.0721752 0.084433 0.04048575 -0.0048353043 -0.010357111 -0.24254088 0.123872384 0.06795292 0.058354862 -0.0924278 0.25570905
0.087117806 -0.057186488 0.24222723 0.0046102796 0.054156974 -0.03447769 0.09587353 -0.015675819 0.009703704 -0.06351056 -0.16185245 0.097795 0.07845944 0.04366533 -0.043812513 0.20302159
-0.12033286 0.19545701 0.31732923 0.18137869 -0.1491861 0.22615197 -0.18394953 -0.22844425 0.23483802 0.17303562 -0.24325718 -0.15418604 -0.17959246 -0.18284406 -0.23760289 0.35320896
0.019094488 0.05589215 0.27747035 0.0093216635 -0.03744544 0.064165235 0.04416203 -0.00037242024 0.068225645 0.01665077 -0.22317336 0.057856657 -0.042340375 -0.035009976 -0.101763465 0.28485936
0.16710165 -0.06288179 0.22370918 -0.04430955 0.008299133 -0.12387165 0.117996536 0.022873737 -0.08183648 -0.11078356 -0.15378515 0.14609973 0.1264015 0.11722314 -0.062144615 0.13573056
0.093750045 -0.036193356 0.06635687 -0.09512182 0.025961913 -0.07996079 0.08794111 0.
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
<OOV>
the
and
i
it
a
is
to
this
was
@kostasx
kostasx / pres.md
Created February 13, 2021 08:56 — forked from whostolebenfrog/pres.md
Notes on: Instantly better presentations - Damian Conway

Instantly better presentations - Damian Conway

It probably just makes more sense to just view his version online at:

http://damian.conway.org/IBP.pdf

But making notes is useful anyway.

7 tips are