Skip to content

Instantly share code, notes, and snippets.

@kconner
kconner / macOS Internals.md
Last active May 10, 2024 17:04
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:

@jasonhorner
jasonhorner / database-metadata-metrics
Last active February 15, 2024 17:16
SQL Server metadata query with column info
with schema_info
as (SELECT t.table_catalog
, t.table_schema
, t.table_name
, (
SELECT
c.column_name,
c.ordinal_position,
CASE
WHEN c.DATA_TYPE IN ('varchar', 'char', 'varbinary', 'binary') THEN
@devigned
devigned / provision.sh
Last active June 8, 2017 19:50
Provision Azure Container Service (Kubernetes), Container Registry, CosmosDB and install Kubernetes developer tools
#!/usr/bin/env bash
set -euf -o pipefail
group="habitat-k8s"
location='westus'
vm_name="habitat-dev"
cluster_name="k8s-cluster"
name_prefix="habk8s"
new_name=$(echo $(mktemp -u ${name_prefix}XXXX) | tr '[:upper:]' '[:lower:]')
@joepie91
joepie91 / random.md
Last active May 7, 2024 17:10
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@ursuad
ursuad / kafka-cheat-sheet.md
Last active March 14, 2024 10:32
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@malbarmavi
malbarmavi / mssql.sql
Last active February 15, 2024 17:16
MS SQL Server Most Useful Queries
select * from master.dbo.sysdatabases;
use DataBaseName;
select * from information_schema.tables;
select TABLE_NAME 'Table Name',COUNT(COLUMN_NAME) 'Column Count'
from information_schema.COLUMNS group by TABLE_NAME order by [TABLE_NAME];
select @@CONNECTIONS;
@lumengxi
lumengxi / Makefile
Created March 17, 2016 16:44
Makefile for Python projects
.PHONY: clean-pyc clean-build docs clean
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
@arttuladhar
arttuladhar / Kitchen-CheetSheet.md
Last active May 26, 2023 16:19
Chef and Knife Commands CheatSheet

Kitchen Commands

kitchen list
kitchen create
kitchen destroy
kitchen login <InstanceName>
@vpack
vpack / tmux.md
Last active March 16, 2017 15:23
tmux

Same as Screen but better

screen split commands

<ctrl> a - enter command mode
S - split uppercase
Q - close - uppercase
| - vertical split
tab - tab to other windows
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active March 6, 2023 00:10
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key