Skip to content

Instantly share code, notes, and snippets.

View martin12333's full-sized avatar

Martin Milan martin12333

View GitHub Profile
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active May 10, 2024 14:19
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ichensky
ichensky / shit.md
Created March 3, 2017 13:59
Why xml and json sucks to s-expressions

For ex. we have struct:

// Keeps info about users account in bank
typedef struct account {
   // account number in bank
   int account_number;
   char *first_name;
   char *last_name;
   // balance in bank 
@sofaking
sofaking / adb.sh
Created March 3, 2017 10:48
Get battery level via adb
adb shell dumpsys battery | grep level
@jefvlamings
jefvlamings / hn-comment-sort.js
Last active October 16, 2023 19:14
Sort Hackernews comments by number of replies
var commentTree = document.getElementsByClassName('comment-tree')[0].getElementsByTagName('tbody')[0];
var colls = document.getElementsByClassName('comtr');
var newColls = []
for(var i=0; i<colls.length; i++) {
newColls.push(colls[i])
}
newColls.sort(function(a,b) {
var counta = parseInt(a.getElementsByClassName('togg')[0].getAttribute('n'), 10)
@Klathmon
Klathmon / .hyper.js
Created December 17, 2016 15:55
hyper config for HN user
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: 'Inconsolata, Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
digraph {
Ruby -> Scala [ label = "Twitter (2011)" ];
MongoDB -> PostgreSQL [ label = "Urban Airship (2011)" ];
"?" -> Go [ label = "MoovWeb (2012)" ];
Perl -> Go [ label = "NTP Pool (2012)" ];
"C++" -> Go [ label = "DLGoogle (2012)" ];
Ruby -> Go [ label = "SoundCloud (2012)" ];
".NET" -> Go [ label = "SmartyStreets (2012)" ];
Ruby -> Go [ label = "Toggl (2012)" ];
MongoDB -> Riak [ label = "Shareaholic (2012)" ];
$ScriptPath = Split-Path -parent $PSCommandPath
. "$ScriptPath\Get-ChildItem-Color\Get-ChildItem-Color.ps1"
Set-Alias l Get-ChildItem-Color -option AllScope
Set-Alias ls Get-ChildItem-Format-Wide -option AllScope
function Get-ChildItem-Force { l -Force }
set-alias la Get-ChildItem-Force -option AllScope
# Load posh-git example profile
@clementi
clementi / kleene2.hs
Last active December 18, 2021 18:12
Kleene (3-valued) logic in Haskell
data Expr = T
| F
| U
| Not Expr
| And Expr Expr
| Or Expr Expr
| Impl Expr Expr
| Equiv Expr Expr
deriving Show
@skovsgaard
skovsgaard / hyperpolyglot-elixir
Last active May 17, 2022 14:58
The content for the Hyperpolyglot entry on Elixir
elixir
======
version used
------------
1.2
show version
------------
$ elixir -v
@nepsilon
nepsilon / 5-handy-javascript-one-liners.md
Last active March 23, 2019 18:09
5 handy Javascript one-liners — First published on fullweb.io issue #48

5 handy JavaScript one-liners

1. Generate a random string:

Math.random().toString(36).substr(2); 

This simply generates a random float, casts it into a String using base 36 and remove the 2 first chars 0 and. Note that this is not a replacement for UUID generation.

2. Clone an array: