Skip to content

Instantly share code, notes, and snippets.

#!/bin/env python3
import random
def get_random_exclude(*n):
while True:
ran = random.randint(0,2)
if ran not in n:
return ran
def montyhall(first_behaviour, second_behaviour):
@gwpl
gwpl / README.md
Last active January 12, 2019 00:19
Adding Custom Page to ppd. Definition of S0929100 Cards for LabelWriter printers (including Dymo 450 LabelWriter), as this roll is missing in Linux Drivers (lw450.ppd and other .ppd files) and Macintosh dymo.ppd file. It's reconstructed by hand. I've send email to technical support, so let's work on this one until official specification for roll…

Definition of S0929100 Cards for LabelWriter printers (including Dymo 450 LabelWriter), as this roll is missing in Linux Drivers (lw450.ppd and other .ppd files) and Macintosh dymo.ppd file. It's reconstructed by hand. I've send email to technical support, so let's work on this one until official specification for roll will arrive.

Please note you need to add each line to appropriate section in .ppd file according to : http://stackoverflow.com/a/3112256/544721 (On my systems, lw450.ppd files were located in /usr/share/cups/model/lw450.ppd)

Update: When I tried to apply patch below on dymo-cups-drivers-1.4.0.5 (dymo-cups-drivers-1.4.0.tar.gz), it turned out that there is already another definition of w144h252 page. Testing:

@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@jackdoerner
jackdoerner / bilateral_approximation.py
Last active November 12, 2022 23:05
Fast Bilateral Filter Approximation Using a Signal Processing Approach in Python
"""
bilateral_approximation.py
Fast Bilateral Filter Approximation Using a Signal Processing Approach in Python
Copyright (c) 2014 Jack Doerner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@goyalankit
goyalankit / bash_to_zsh_history.rb
Last active October 28, 2023 05:07
Import bash history to zsh history.
#################################################################
# = This script transfers bash history to zsh history
# = Change bash and zsh history files, if you don't use defaults
#
# = Usage: ruby bash_to_zsh_history.rb
#
# = Author: Ankit Goyal
#################################################################
# change if you don't use default values