Skip to content

Instantly share code, notes, and snippets.

View AtHeartEngineer's full-sized avatar
🏠
Working from home

AtHeartEngineer AtHeartEngineer

🏠
Working from home
View GitHub Profile
@ottodevs
ottodevs / StringToLower.sol
Created September 26, 2017 11:22 — forked from thomasmaclean/StringToLower.sol
Ethereum/Solidity toLower() equivalent, to transform strings to lowercase
pragma solidity ^0.4.11;
contract StringToLower {
function _toLower(string str) internal returns (string) {
bytes memory bStr = bytes(str);
bytes memory bLower = new bytes(bStr.length);
for (uint i = 0; i < bStr.length; i++) {
// Uppercase character...
if ((bStr[i] >= 65) && (bStr[i] <= 90)) {
// So we add 32 to make it lowercase
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active February 29, 2024 16:29
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@EdwardBetts
EdwardBetts / pprint_color.py
Last active March 19, 2024 18:17
Python pprint with color syntax highlighting for the console
from pprint import pformat
from typing import Any
from pygments import highlight
from pygments.formatters import Terminal256Formatter
from pygments.lexers import PythonLexer
def pprint_color(obj: Any) -> None:
"""Pretty-print in color."""
@tadly
tadly / pacaur_install.sh
Last active August 30, 2023 13:15
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
#
# !!! IMPORTANT !!!
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144)
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though.
#
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time
@jhcepas
jhcepas / print_table.py
Last active June 6, 2020 18:20
nice table printing in python
def print_table(items, header=None, wrap=True, max_col_width=20, wrap_style="wrap", row_line=False, fix_col_width=False):
''' Prints a matrix of data as a human readable table. Matrix
should be a list of lists containing any type of values that can
be converted into text strings.
Two different column adjustment methods are supported through
the *wrap_style* argument:
wrap: it will wrap values to fit max_col_width (by extending cell height)
cut: it will strip values to max_col_width