Skip to content

Instantly share code, notes, and snippets.

View Zverik's full-sized avatar

Ilya Zverev Zverik

View GitHub Profile
@fomightez
fomightez / useful_notebook_snippets
Last active November 16, 2023 18:12
Useful snippets for Jupyter notebooks
# Use `%%capture` to hush 'noisy' stdout and stderr streams, but still combine with getting `%%time` after
%%capture out_stream
%%time
---rest of a cell that does something with LOTS of output--
#In cell after, put following to get time of completion from that:
#time it took to run cell above
for x in out_stream.stdout.split("\n")[-3:]:
print(x)
@jgornick
jgornick / ansible.yml
Created May 19, 2015 12:49
Ansible: Remove All Files Except
---
- name: Capture files in path and register
shell: >
ls -1 /path/to/files
register: files
- name: Remove files except specified
file:
path: "/path/to/files/{{ item }}"
state: absent
@lonvia
lonvia / gist:f24516f8672a0fad2740
Created May 8, 2014 15:24
Creating regional OSM .osc diffs
#!/bin/bash
cd /tmp
SCRIPTDIR=/etc/planet/hourly.d
BASEDIR=/srv/planet.osm.ch
DATADIR=$BASEDIR/data
WWWDIR=$BASEDIR/site
LOCKFILE=$DATADIR/chextract.lock
BBOX="5,45.3,11.3,48.3"

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@crccheck
crccheck / README.md
Last active March 2, 2024 16:39
Python Packaging

What the Hell? -- A Journey Through the Nine Circles of Python Packing

Writing a setup.py

map

I am no Virgil, but having stumbled my way through Python packaging a few times already, I'm documenting the things I learn as I go here.

To help me learn, I took a survey of the top 15 Python packages on Github along with 12 other commonly referenced packages. I thought... if there are any best

@sgmurphy
sgmurphy / url_slug.php
Created July 12, 2012 15:52
URL Slugs in PHP (with UTF-8 and Transliteration Support)
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.