Skip to content

Instantly share code, notes, and snippets.

@sbarratt
sbarratt / scrape_ftx.py
Last active July 10, 2023 03:35
A script to export all FTX history
import pandas as pd
import time
import requests
import time
import hmac
from requests import Request
import sys
import json
import os

中国传统色

《色谱》. 中科院科技情报编委会名词室. 科学出版社, 1957.

ID 预览 名称 英文 色号 反预览 反色号
1 ██████ 暗玉紫 ANYUZI #5C2223 ██████ #A3DDDC
2 ██████ 牡丹粉红 MUDANFENHONG #EEA2A4 ██████ #115D5B
3 ██████ 栗紫 LIZI #5A191B ██████ #A5E6E4
4 ██████ 香叶红 XIANGYEHONG #F07C82 ██████

Some thoughts on building software

Lately I have been busy reading some new books on Domain Driven Design (DDD) and software architecture -- including a short yet eye-opening one in Python and a great one in F#. At the same time, it seems that more people in the Functional Programming world are looking at more formal approaches to modelling -- some examples here. This has brought some thought from the background of my brain about how we should model, organize, and architect software using the lessons we've learnt from functional programming.

Before moving on, let me be clear about this being just a dump of some thoughts, not always well-defined, definite

@samrocketman
samrocketman / libimobiledevice_ifuse_Ubuntu.md
Last active July 3, 2024 07:05
On Ubuntu 16.04, since iOS 10 update, libimobiledevice can't connect to my iPhone. This is my attempt to document a fix.

Why this document?

I upgraded my iPhone 5s to iOS 10 and could no longer retrieve photos from it. This was unacceptable for me so I worked at achieving retrieving my photos. This document is my story (on Ubuntu 16.04).

The solution is to compile libimobiledevice and ifuse from source.

Audience

Who is this guide intended for?

@amueller
amueller / abomination.py
Created July 28, 2016 21:02
binary operators on all estimators
from sklearn.base import BaseEstimator
def piper(self, other):
from sklearn.pipeline import make_pipeline, Pipeline
if isinstance(self, Pipeline):
steps = ([estimator for (name, estimator) in self.steps] + [other])
return make_pipeline(*steps)
else:
return make_pipeline(self, other)
@Ayehavgunne
Ayehavgunne / parse.py
Last active March 17, 2025 20:49
Parse a string into a timedelta object in Python
from decimal import Decimal
from datetime import timedelta
def duration(duration_string): #example: '5d3h2m1s'
duration_string = duration_string.lower()
total_seconds = Decimal('0')
prev_num = []
for character in duration_string:
if character.isalpha():
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@willurd
willurd / web-servers.md
Last active May 13, 2025 13:11
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@stephenLee
stephenLee / bithack.cc
Created November 6, 2012 13:56
bit manipulation tricks(collections)
/*
* Reference:
* http://www.quora.com/Computer-Programming/What-are-some-cool-bit-manipulation-tricks-hacks
* http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/
*/
#include <iostream>
#include <string.h>
using namespace std;