Skip to content

Instantly share code, notes, and snippets.

@progrium
progrium / README.md
Last active April 1, 2025 13:12
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

@prologic
prologic / LearnGoIn5mins.md
Last active February 12, 2025 06:52
Learn Go in ~5mins
#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
@IanColdwater
IanColdwater / twittermute.txt
Last active April 14, 2025 16:31
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@gentoo90
gentoo90 / caja-syncthing.py
Created December 5, 2014 22:16
Syncthing integration for Caja
'''
Syncthing integration for Caja (MATE file manager)
1) Put it into ~/.local/share/caja-python/extensions
2) Install python-caja:
# sudo apt-get install python-caja
3) Install python-requests:
$ sudo add-apt-repository ppa:deluge-team/ppa
@soheilhy
soheilhy / nginxproxy.md
Last active April 11, 2025 06:29
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

$ flask -a myapp
Usage: flask [OPTIONS] COMMAND [ARGS]...
This shell command acts as general utility script for Flask applications.
It loads the application configured (either through the FLASK_APP
environment variable or the --app parameter) and then provides commands
either provided by the application or Flask itself.
The most useful commands are the "run" and "shell" command.
IT'S SHOWTIME
HEY CHRISTMAS TREE isLessThan100
YOU SET US UP @NO PROBLEMO
HEY CHRISTMAS TREE n
YOU SET US UP 0
HEY CHRISTMAS TREE multiple
YOU SET US UP @NO PROBLEMO
STICK AROUND isLessThan100
@claviska
claviska / jquery.offscreen.js
Created October 30, 2013 21:36
jQuery offscreen plugin
/*
* jQuery offscreen plugin
*
* Filters that detect when an element is partially or completely outside
* of the viewport.
*
* Usage:
*
* $('#element').is(':off-bottom')
*