Skip to content

Instantly share code, notes, and snippets.

@stevewithington
stevewithington / find-replace-sed.md
Last active June 27, 2024 15:19
Find & Replace within an Entire Directory or Git Repo with sed

Find & Replace within an Entire Directory or Git Repo with sed

If replacing within a directory:

grep -rl 'apples' /dir_to_search_under | xargs sed -i 's/apples/oranges/g'

Or, within an entire git repository:

@dmfigol
dmfigol / asyncio_loop_in_thread.py
Last active June 30, 2024 09:29
Python asyncio event loop in a separate thread
"""
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
"""
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable
@paolocarrasco
paolocarrasco / README.md
Last active June 30, 2024 23:49
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@cstockton
cstockton / steps.md
Last active March 5, 2018 19:27
*ubuntu install steps macbook pro 2016

Install the iso

  • press and hold alt right after powering on
  • select EFI BOOT
  • select try ubuntu gnome
  • control + e
  • delete quiet and splash, nomodeset intremap=nosid
  • hit f10 to boot into live cd

luks

@mmellison
mmellison / grpc_asyncio.py
Last active April 3, 2024 15:48
gRPC Servicer with Asyncio (Python 3.6+)
import asyncio
from concurrent import futures
import functools
import inspect
import threading
from grpc import _server
def _loop_mgr(loop: asyncio.AbstractEventLoop):
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active June 21, 2024 14:47
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

@graphadvantage
graphadvantage / neo4j-kakfa-demo.md
Last active December 2, 2022 17:32
Neo4j GraphGist: Enterprise Architectures - Real-time Neo4j Graph Updates using Kafka Messaging

##Neo4j GraphGist - Enterprise Architectures: Real-time Graph Updates using Kafka Messaging

Neo4j Use Case: Low Latency Graph Analytics & OLTP - Update 1M Nodes in 90 secs with Kafka and Neo4j Bolt

Introduction

A recent Neo4j whitepaper describes how Monsanto is performing real-time updates on a 600M node Neo4j graph using Kafka to consume data extracted from a large Oracle Exadata instance.

This modern data architecture combines a fast, scalable messaging platform (Kafka) for low latency data provisioning and an enterprise graph database (Neo4j) for high performance, in-memory analytics & OLTP - creating new and powerful real-time graph analytics capabilities for your enterprise applications.

@onjin
onjin / docker-compose.yml
Created September 5, 2016 09:17
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@cairabbit
cairabbit / cte.sqlalchemy.py
Last active May 22, 2024 11:12
SqlAlchemy CTE recursive sample
from sqlalchemy.orm import sessionmaker, relationship, aliased
from sqlalchemy import cast, Integer, Text, Column, ForeignKey, literal, null
from sqlalchemy.sql import column, label
class Catalog(Base):
__tablename__ = 'catalog'
id = Column(String, primary_key=True)
parentid = Column(String, ForeignKey('catalog.id'))
name = Column(String)
parent = relationship("Catalog", remote_side=[id])