Skip to content

Instantly share code, notes, and snippets.

View pawelkata's full-sized avatar
💭
bitcoinmaximalist.app

Paweł Kata pawelkata

💭
bitcoinmaximalist.app
View GitHub Profile
@stonehippo
stonehippo / nodejs_raspberry_pi.md
Last active August 11, 2024 19:08
Methods for installing Node.js on Raspberry Pi

Setting Up Node.js On Raspberry Pi

There are several ways that you can set up Node.js on a Raspberry Pi when running Raspbian/Rapberry Pi OS. Depending on your needs, the version of the RPi that you're using, and how you like to manage installs, you have a lot of options.

Node.js from source

Do not do this if you can avoid it, it's super slow. If you insist on doing it and have the time, you can start at https://nodejs.org. But really, don't do this.

If you have tons of time on your hands, don't need Node anytime soon, and insist on building from source for some reason, here's a guide you can try out that covers building Node.js on an ARMv6 Raspberry Pi.

Side note: unless you have a need for the latest and greatest features, I recommend developing using the most recent Long Term Support (LTS) version of Node available, especially for anything you plan to put into production for any length of time.

@munificent
munificent / generate.c
Last active September 15, 2024 03:16
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@killants
killants / findPaths.js
Last active November 10, 2022 04:34
Sharing knowledge
/**
* searches deep into an object recursively...
* @param {Object} obj object to be searched
* @param {any} searchValue the value/key to search for
* @param {Object} [options]
* @param {boolean} options.[searchKeys] whether to search object keys as well as values. Defaults to `true` if `serchValue` is a string, `false` otherwise.
* @param {number} options.[maxDepth=20] maximum recursion depth (to avoid "Maximum call stack size exceeded")
* @returns {string[]} Paths on the object to the matching results
*/
const findPaths = (

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing
@aras-p
aras-p / preprocessor_fun.h
Last active November 15, 2024 09:22
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@rsattar
rsattar / gist:1896546
Created February 24, 2012 01:28
RegexKitLite's arrayOfCaptureComponentsMatchedByRegex: written using NSRegularExpression
// I had a need to replace the use of RegexKitLite's arrayOfCaptureComponentsMatchedByRegex with
// the built-in NSRegularExpression in iOS 5+, and didn't find an existing example, so I wrote one:
- (NSArray *) arrayOfCaptureComponentsOfString:(NSString *)data matchedByRegex:(NSString *)regex
{
NSError *error = NULL;
NSRegularExpression *regExpression = [NSRegularExpression regularExpressionWithPattern:regex options:NSRegularExpressionCaseInsensitive error:&error];
NSMutableArray *test = [NSMutableArray array];
@interface UIImage (Shadow)
+ (UIImage *)imageWithContentsOfFile:(NSString *)path withShadow:(BOOL)applyShadow;
+ (UIImage *)imageNamed:(NSString *)name withShadow:(BOOL)applyShadow;
+ (UIImage *)applyShadow:(UIImage *)theImage;
@end