Skip to content

Instantly share code, notes, and snippets.

View codewithgun's full-sized avatar

kampung-tech codewithgun

  • Kuala Lumpur, Malaysia
View GitHub Profile
@codewithgun
codewithgun / README.md
Created March 2, 2024 17:15 — forked from progrium/README.md
Setting up M1 Macs for x86 development with Homebrew

Key Points

  • In general, binaries built just for x86 architecture will automatically be run in x86 mode
  • You can force apps in Rosetta 2 / x86 mode by right-clicking app, click Get Info, check "Open using Rosetta"
  • You can force command-line apps by prefixing with arch -x86_64, for example arch -x86_64 go
  • Running a shell in this mode means you don't have to prefix commands: arch -x86_64 zsh then go or whatever
  • Don't just immediately install Homebrew as usual. It should most likely be installed in x86 mode.

Homebrew

Not all toolchains and libraries properly support M1 arm64 chips just yet. Although

@codewithgun
codewithgun / example-typeorm-jest.test.ts
Created September 19, 2021 09:59 — forked from Ciantic/example-typeorm-jest.test.ts
Example of testing TypeOrm with Jest and Sqlite in-memory database
import { createConnection, getConnection, Entity, getRepository } from "typeorm";
import { PrimaryGeneratedColumn, Column } from "typeorm";
@Entity()
export class MyEntity {
@PrimaryGeneratedColumn()
id?: number;
@Column()
name?: string;
@codewithgun
codewithgun / nodejs-tcp-example.js
Created July 18, 2021 16:43 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@codewithgun
codewithgun / multi-git-account.md
Last active April 19, 2021 16:08 — forked from developius/README.md
Setup SSH keys for use with GitHub/GitLab/BitBucket etc