Skip to content

Instantly share code, notes, and snippets.

View rootscript's full-sized avatar

Carlos rootscript

  • UK
View GitHub Profile
@sammchardy
sammchardy / convert-binance-interval-to-milliseconds.py
Last active April 26, 2019 07:51
Convert Binance interval to milliseconds
def interval_to_milliseconds(interval):
"""Convert a Binance interval string to milliseconds
:param interval: Binance interval string 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w
:type interval: str
:return:
None if unit not one of m, h, d or w
None if string not in correct format
int value of interval in milliseconds
@sammchardy
sammchardy / convert-date-to-milliseconds.py
Last active August 15, 2018 12:46
Convert date to millisecond timestamp
# requires dateparser package
import dateparser
import pytz
from datetime import datetime
def date_to_milliseconds(date_str):
"""Convert UTC date to milliseconds
If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC"
@random-robbie
random-robbie / BBC.m3u
Last active May 2, 2024 02:40
BBC HLS Streams - let me know if i missed any
#EXTM3U
#EXTINF:-1 tvg-id="BBC One HD" tvg-name="BBC One HD" tvg-logo="https://s4.postimg.org/k5xl5dmf1/bbc_one.png" group-title="BBC",BBC One HD
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_one_hd.m3u8
#EXTINF:-1 tvg-id="BBC One London" tvg-name="BBC One London" tvg-logo="https://s4.postimg.org/z61nj8qd9/Bbc_london_logo.jpg" group-title="BBC",BBC One London
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_tablet/ak/bbc_one_london.m3u8
#EXTINF:-1 tvg-id="BBC One Northern Ireland HD" tvg-name="BBC One Northern Ireland HD" tvg-logo="https://s3.postimg.org/ltztuojqr/6y_QROLCn_400x400.png" group-title="BBC",BBC One Northern Ireland HD
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_one_northern_ireland_hd.m3u8
#EXTINF:-1 tvg-id="BBC One Scotland HD" tvg-name="BBC One Scotland HD" tvg-logo="https://s3.postimg.org/ltztuojqr/6y_QROLCn_400x400.png" group-title="BBC",BBC One Scotland HD
http://a.fi
@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@kgmyshin
kgmyshin / private.xml
Last active May 17, 2021 01:58
karabiner private.xml
<?xml version="1.0"?>
<root>
<!-- for RealForce -->
<devicevendordef>
<vendorname>RealForce_VendorID</vendorname>
<vendorid>0x0853</vendorid>
</devicevendordef>
<deviceproductdef>
@raine
raine / ramda
Last active May 4, 2020 12:14
Browse Ramda documentation in Terminal
#!/usr/bin/env bash
# Browse Ramda documentation in Terminal
# Requires jq and a tool such as fzf or peco for interactive filtering
LATEST="http://raine.github.io/ramda-json-docs/latest.json"
DOCS_URL="http://ramdajs.com/docs/"
json=$(curl -s $LATEST)
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end')
@leommoore
leommoore / file_magic_numbers.md
Last active May 2, 2024 14:47
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@mlan3
mlan3 / private.xml
Created January 6, 2015 16:40
Karabiner private.xml for non-Apple keyboard to toggle Target Display Mode
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>LOGITECH</vendorname>
<vendorid>0x046d</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>LOGITECH_K811</productname>
<productid>0xb317</productid>
@ddo
ddo / README.md
Last active March 24, 2023 19:17 — forked from nicerobot/README.md
uninstall-node.sh

To run this, you can try:

curl -ks https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh

chmod +x ./uninstall-node.sh

@chehab
chehab / private.xml
Last active October 10, 2015 18:40
Karabiner (keyremap4macbook): private.xml for PC Keyboard
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>A4TECH</vendorname>
<vendorid>0x09da</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>A4TECH_PC_KB</productname>