Skip to content

Instantly share code, notes, and snippets.

@kconner
kconner / macOS Internals.md
Last active June 21, 2024 20:02
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@avoidik
avoidik / README.md
Last active April 5, 2024 06:43
Migrate Raspberry Pi from SD to USB

Raspberry Pi from SD to USB

How to switch over from SD-card to USB-attached device (USB thumbstick, USB enclosed SSD or HDD, etc.) to have more durable storage option.

Steps

  1. Connect USB device to your RPI

  2. Make sure USB device visible by the system

@superseb
superseb / get_kubeconfig_custom_cluster_rancher2.sh
Last active October 13, 2023 05:51
Get kubeconfig for custom cluster in Rancher 2.x
#!/bin/bash
# Usage: ./get_kubeconfig_custom_cluster_rancher2.sh cluster_name
# Needs to be run on the server running `rancher/rancher` container
# Check if jq exists
command -v jq >/dev/null 2>&1 || { echo "jq is not installed. Exiting." >&2; exit 1; }
# Check if clustername is given
if [ -z "$1" ]; then
echo "Usage: $0 [clustername]"
@Restuta
Restuta / howto-put-git-repo-into-another-repo.md
Last active April 22, 2021 16:43
How to make git repo to be another's repo subfolder preserving history

Hacky way (let me know if you know better one)

Let's say you have repo Main and repo Proto, you want to put your Proto under Main, so folder structure will be the following:

|-SRC
   |---proto

and you also want to preserve commit history, so everybody can see what you were doing while developing proto, sounds like pretty easy task. The easiest way is to create folder structure similar to Main repo SRC\proto and start working using is as a root, but if you like me, you didn't think about this beforehand, so you path would be harder:

@xmasotto
xmasotto / mongo-connector
Created July 25, 2014 18:04
Mongo Connector init script (tested on debian, centos, fedora)
#!/bin/bash
#
# mongo-connector Start Mongo Connector
#
# chkconfig: 345 90 25
# description: Mongo Connector replicates data from MongoDB to external
# database systems.
### BEGIN INIT INFO
# Provides: mongo-connector
@jnrbsn
jnrbsn / gist:8062545
Created December 20, 2013 22:18
Install Python 2.7, easy_install, and pip on Amazon Linux
sudo yum update
sudo yum install python27
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo /usr/bin/python27
sudo easy_install pip
echo "alias python='python27'" >> ~/.bashrc
source ~/.bashrc
@fjavieralba
fjavieralba / KafkaLocal.java
Last active March 23, 2021 09:57
Embedding Kafka+Zookeeper for testing purposes. Tested with Apache Kafka 0.8
import java.io.IOException;
import java.util.Properties;
import kafka.server.KafkaConfig;
import kafka.server.KafkaServerStartable;
public class KafkaLocal {
public KafkaServerStartable kafka;
public ZooKeeperLocal zookeeper;
@docteurklein
docteurklein / spec.php
Created April 26, 2013 13:24
phpspec mock Symfony's request
<?php
/**
* @param Symfony\Component\HttpFoundation\Request $request
* @param Symfony\Component\HttpFoundation\ParameterBag $bag
*/
function let($request, $bag)
{
$bag->get('id')->willReturn(1);
$request->query = $bag;
@SzymonPobiega
SzymonPobiega / gist:5220595
Last active April 25, 2024 17:19
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht