Skip to content

Instantly share code, notes, and snippets.

View lucianolacurcia's full-sized avatar

Luciano Lacurcia lucianolacurcia

  • Montevideo, Uruguay
View GitHub Profile
@quinn-dougherty
quinn-dougherty / epspy.md
Last active April 15, 2021 15:13
epsilon-delta proofs of limits for the pythonista

Functions

The propositions-as-types interpretation states that proofs are programs. The meaning of this applies principally to functional programming, so let's first limit the python-space with constraints.

  1. We will deal with total functions, meaning if I say def f(x: float) -> float:, what I mean is that you can give f any float. A vocabulary I might use is "signature", in this case, f's "signature" (or its "type signature" or just "type") is float -> float, meaning it's input or argument type is float and its output or return type is float.
  2. We will deal with pure functions, meaning if I say that f is a function, what I mean is that its behavior is constrained entirely by its signature, and I can test it by supplying inputs and doing nothing else. If I need to test it by mocking up state or running a headless browser, then it is not pure.
  3. Functions that are total and pure are deterministic, meaning for every state from which anybody could call
@adeutscher
adeutscher / hotplug-testing.py
Last active July 11, 2021 18:49
Exploration of using pyudev for hotplug events.
#!/usr/bin/env python
'''
A bit of exploration kicked off by this example: https://avilpage.com/2016/09/detecting-device-events-in-ubuntu-with-python.html
Useful documentation links:
* https://pyudev.readthedocs.io/en/v0.12/api/device.html
* https://pyudev.readthedocs.io/en/v0.13/api/monitor.html
* https://pyudev.readthedocs.io/en/latest/guide.html
Other:
@dropmeaword
dropmeaword / browser_history.md
Last active August 18, 2025 15:34
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

@airawat
airawat / 00-CustomGenericUDFHive-NVL2
Last active December 20, 2022 15:39
Custom genericUDF in Hive Demonstrates NVL2 functionality
This gist covers a simple Hive genericUDF in Java, that mimics NVL2 functionality in Oracle.
NVL2 is used to handle nulls and conditionally substitute values.
Included:
1. Input data
2. Expected results
3. UDF code in java
4. Hive query to demo the UDF
5. Output
@Sn0wCrack
Sn0wCrack / INIFile.cs
Last active September 18, 2024 07:49
A simple way to read INI Files with C#
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace <INSERT_NAMESPACE_HERE>
{
public class INIFile
{
public string path { get; private set; }