Skip to content

Instantly share code, notes, and snippets.

View allenyllee's full-sized avatar

Allen.YL allenyllee

View GitHub Profile
@y56
y56 / ERROR launchpadlib 1.10.6 requires testresources which is not installed
Created April 11, 2020 19:26
ERROR: launchpadlib 1.10.6 requires testresources, which is not installed.
https://www.discoverbits.in/864/error-launchpadlib-requires-testresources-which-installed
==
ERROR: launchpadlib 1.10.6 requires testresources, which is not installed.
+2 votes
asked Oct 6, 2019 in Programming Languages by pythonuser (11.5k points)
recategorized Oct 6, 2019 by pythonuser
I am getting the following error when I try to upgrade setuptools:
@ojdo
ojdo / pandas-to-excel.py
Last active April 12, 2022 10:47
From Pandas to Excel using Openpyxl
import pandas as pd
from io import StringIO
from openpyxl.formatting.rule import ColorScaleRule
from openpyxl.styles import Alignment, Font, NamedStyle
from openpyxl.utils import get_column_letter
df = pd.read_csv(StringIO("""\
alpha beta gamma
2000-01-01 -0.173215 0.119209 -1.044236
2000-01-02 -0.861849 -2.104569 -0.494929
@gvolpe
gvolpe / shared-state-in-fp.md
Last active March 15, 2022 20:27
Shared State in pure Functional Programming

Shared State in pure Functional Programming

Newcomers to Functional Programming are often very confused about the proper way to share state without breaking purity and end up having a mix of pure and impure code that defeats the purpose of having pure FP code in the first place.

Reason why I decided to write up a beginner friendly guide :)

Use Case

We have a program that runs three computations at the same time and updates the internal state to keep track of the

@joeharr4
joeharr4 / ssh-cipher-benchmark.sh
Last active April 20, 2024 05:38 — forked from dlenski/ssh-cipher-benchmark.sh
Check speed of ssh cipher(s) on your system
#!/bin/bash
# ssh-cipher-benchmark.sh - Assesses speed of SSH encryption between specific hosts.
# Usage:
# ssh-cipher-benchmark.sh <remotehost> [ciphers]
# Default ciphers: all we can find...
#
# Note: In some cases, the first cipher tested runs faster than the others, regardless of order.
# Cause of this is not known, but changing the order of testing shows it to be true. Run the
# first one twice if you suspect this. Perhaps it is due to buffering?
@harry-cpp
harry-cpp / VSCodeExtension.py
Last active November 17, 2023 16:21
VSCode extension for Nautilus
Moved to:
https://github.com/cra0zy/code-nautilus
since people want to add features to it and no notification arrive from comments on gist.
@Brainiarc7
Brainiarc7 / skylake-tuning-linux.md
Last active March 30, 2024 16:01
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

@lentschi
lentschi / xsudo.sh
Last active July 29, 2020 22:32
Run a program requiring xserver as another user by passing on the xauth cookie
#!/bin/bash -e
# Run a program requiring xserver as another user by passing on the xauth cookie
# s. http://askubuntu.com/questions/871092/failed-to-connect-to-mir-failed-to-connect-to-server-socket-no-such-file-or-di?newreg=811c7a1d637341c5b294d8b515e8b6e7
# s. http://serverfault.com/questions/51005/how-to-use-xauth-to-run-graphical-application-via-other-user-on-linux
# AUTHOR: Florian Lentsch <office@florian-lentsch.at>
# TESTED: on Ubuntu 16.04 only
#
# USAGE: xsudo <username> <command>
@super3
super3 / payout.MD
Last active September 8, 2020 01:48
Storj Bridge Payout Formula

Payout Formula

paymentModelFunction = function(gbHours, telemReports, downloadedBytes) {
 gbHoursScaled =  (gbHours - mean(gbHours)) / sd(gbHours)
 telemReportsScaled =  (telemReports - mean(telemReports)) / sd(telemReports)
 downloadedBytesScaled = (downloadedBytes - mean(downloadedBytes)) / sd(downloadedBytes)
 
 basePayout = 10
 ghHourPayout = 12.2221 * gbHoursScaled
 telemReportsPayout = 0.1452 * telemReportsScaled
@akiross
akiross / Convolutional Arithmetic.ipynb
Last active March 12, 2024 16:31
Few experiments on how convolution and transposed convolution (deconvolution) should work in tensorflow.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dooglus
dooglus / public.py
Created August 13, 2016 20:45
create Bitcoin public key from private key
#! /usr/bin/env python
class Point(object):
def __init__(self, _x, _y, _order = None): self.x, self.y, self.order = _x, _y, _order
def calc(self, top, bottom, other_x):
l = (top * inverse_mod(bottom)) % p
x3 = (l * l - self.x - other_x) % p
return Point(x3, (l * (self.x - x3) - self.y) % p)