Skip to content

Instantly share code, notes, and snippets.

View dexXxed's full-sized avatar
🐍
Nice to see you here

dexXxed

🐍
Nice to see you here
View GitHub Profile
@npearce
npearce / install-docker.md
Last active April 19, 2024 12:35
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@PatrikHlobil
PatrikHlobil / nested_iterator.py
Last active February 9, 2024 23:29
Get all keys or values of a nested dictionary or list in Python
def iterate_all(iterable, returned="key"):
"""Returns an iterator that returns all keys or values
of a (nested) iterable.
Arguments:
- iterable: <list> or <dictionary>
- returned: <string> "key" or "value"
Returns:
@EliotAndres
EliotAndres / benchmark.py
Created June 7, 2017 21:12
Tensorflow XLA benchmark
# '''
# A small Tensorflow XLA benchmark
#
# Original Author: Aymeric Damien
# Project: https://github.com/aymericdamien/TensorFlow-Examples/
# '''
import tensorflow as tf
@Yagisanatode
Yagisanatode / Tkinter_filedialog.py
Last active July 15, 2021 11:58
Python 3 - Open file dialog window in tkinter with filedialog
#! Python 3.4
"""
Open a file dialog window in tkinter using the filedialog method.
Tkinter has a prebuilt dialog window to access files.
This example is designed to show how you might use a file dialog askopenfilename
and use it in a program.
"""
@laurenarcher
laurenarcher / bitconvert.py
Last active June 14, 2022 07:28
Simple python bitcoin currency converter using the Bitcoin Charts API. Documentation here: http://bitcoincharts.com/about/markets-api/
import urllib2
import json
data = urllib2.urlopen("http://api.bitcoincharts.com/v1/weighted_prices.json")
def convert_to_bitcoin(amount, currency):
bitcoins = json.loads(data.read())
converted = float(bitcoins[currency]["24h"]) * amount
print converted
@alphazo
alphazo / gist:3303282
Created August 9, 2012 11:03
Clone MiFare cards using chinesse UUID writable cards

libnfc supports UUID writable cards and even has some dedicated tools for them.

However it doesn't work with some of the cards found on eBay that are even simpler to use. Sector 0 is unlocked and can be written without any additional commands. libnfc requires a small patch to get it working.

Following has been tested under ArchLinux with modified libnfc 1.5.1, mfoc 0.10.2 and a SCL3711 dongle.

Patch & recompile libnfc

The patch is fairly simple, open libnfc-1.5.1/utils/nfc-mfclassic.c and comment 2 lines (it was lines 384 and 385 for me):

// Try to write the trailer

@raullenchai
raullenchai / katan.c
Created May 16, 2012 17:40
The KATAN/KTANTAN Family of Block Ciphers
#include <stdio.h>
/*
Fork From http://www.cs.technion.ac.il/~orrd/KATAN/katan.c
Reference BITSLICED implementations of:
KATAN32, KATAN48, KATAN64, KTANTAN32, KTANTAN48 and KTANTAN64.
Each of the 64 slices corresponds to a distinct instance.
To work with a single instance, use values in {0,1}