Skip to content

Instantly share code, notes, and snippets.

import multiprocessing as mp
import subprocess
import sys
import time
import os
print("hello!", sys.argv)
<script src="random_groups2.js"></script>
@nonZero
nonZero / download_nli_image.py
Created December 14, 2017 13:41
Requirements: python 3.6, `tqdm` and `pillow. To install: pip install tqdm pillow
import io
import itertools
import logging
from collections import namedtuple
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from urllib.request import urlretrieve, urlopen
import requests
import tqdm
@nonZero
nonZero / detect_redirects.sparql
Created June 11, 2018 20:25
WikiData: Detect Redirects with SPARQL
select ?a ?b {
values ?a {
wd:Q1
wd:Q2
wd:Q42
wd:Q52088081
}
?a owl:sameAs ?b .
}
@nonZero
nonZero / output
Created July 18, 2018 09:25
below is the expected output of:
00000000: 4d79 206e 616d 6520 6973 2049 6e69 676f My name is Inigo
00000010: 204d 6f6e 746f 7961 0a59 6f75 206b 696c Montoya.You kil
00000020: 6c65 6420 6d79 2066 6174 6865 720a 5072 led my father.Pr
00000030: 6570 6172 6520 746f 2064 6965 2121 2121 epare to die!!!!
00000040: 0a3d 3d3d 3d3d 3d3d 3d3d 2054 4845 2045 .========= THE E
00000050: 4e44 203d 3d3d 3d3d 3d3d 3d3d 3d3d ND ===========
%pylab inline
BRUSH_STROKE_SIZE = 4
palette = imread('palette.png')
image = imread('starry-night-800.jpg')
png = np.ones(image.shape)
num_of_strokes = [1000, 10000, 100000]
for num in num_of_strokes:
for index in range(num):
row = np.random.randint(0, png.shape[0]-4)
column = np.random.randint(0, png.shape[1]-4)
#!/usr/bin/python
import os
import subprocess
import sys
if "--hebrew" in sys.argv:
print("איזה קומבינה!!!")
elif "--audio" in sys.argv:
subprocess.check_output(['play', '-q', os.path.join(os.path.dirname(__file__), 'netanel.opus')])
else:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Stuff to do on a new Ubuntu 20.04 machine - for kids.

bit.ly/i2004

# Disable lock screens
gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'
gsettings set org.gnome.desktop.screensaver lock-enabled false

mkdir -p ~/Downloads
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.