Skip to content

Instantly share code, notes, and snippets.

View notthetup's full-sized avatar
🔊

Chinmay Pendharkar notthetup

🔊
View GitHub Profile
#!/bin/bash
set -e
##### CHECK PARAMETERS #####
PRODUCTION=0
while [[ "$#" -gt 0 ]]; do
case $1 in
-p|--production) PRODUCTION=1 ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
@fardjad
fardjad / how-to-start-colima-automatically-on-macos.md
Last active January 27, 2025 16:59
[How to start Colima automatically on macOS] Instructions for starting Colima automatically on macOS similar to Docker Desktop #macos #colima #docker

⚠️ Note: Since the merge of the commit Homebrew/homebrew-core#149670, starting Colima is as easy as running brew services start colima. You can skip the following work-around.

Steps

  1. Create an executable script to run in foreground and manage colima:
cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg
#!/bin/bash
@Ruminat
Ruminat / groovy-language-definition-for-monaco.ts
Created February 5, 2022 12:32
A Groovy language for monaco editor
import { languages } from "monaco-editor";
function getTokens(tokens: string, divider = "|"): string[] {
return tokens.split(divider);
}
const wordPattern = /(-?\d*\.\d\w*)|([^`~!@#%^&*()\-=+[{\]}\\|;:'",./?\s]+)/g;
const brackets: languages.CharacterPair[] = [
["{", "}"],
@m-radzikowski
m-radzikowski / script-template.sh
Last active January 27, 2025 07:00
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@IanColdwater
IanColdwater / twittermute.txt
Last active February 23, 2025 18:09
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
@ShreyasSkandan
ShreyasSkandan / get_jetpack_main.bash
Last active July 12, 2023 02:23
Installing CUDA on Jetson (Manual Installation)
#!/bin/bash
# For latest CUDA 9.0
wget http://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/3.2GA/m892ki/JetPackL4T_32_b196/cuda-repo-l4t-9-0-local_9.0.252-1_arm64.deb
# For latest CUDNN 7.0.5
wget http://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/3.2GA/m892ki/JetPackL4T_32_b196/libcudnn7_7.0.5.13-1+cuda9.0_arm64.deb
wget http://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/3.2GA/m892ki/JetPackL4T_32_b196/libcudnn7-dev_7.0.5.13-1+cuda9.0_arm64.deb
wget http://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/3.2GA/m892ki/JetPackL4T_32_b196/libcudnn7-doc_7.0.5.13-1+cuda9.0_arm64.deb
@rterbush
rterbush / wireless-link-wds.sh
Created October 23, 2017 01:28 — forked from braian87b/wireless-link-wds.sh
How to setup Wireless Links to avoid Wired backbone using WDS on Atheros for OpenWRT / LEDE

JNI Example (Mac OS)

JNI (Java Native Interface) allows implementing methods in C/C++, and use them in Java.

1. Create JNIExample.java file

class JNIExample {

  // Native method, no body.
@AugmentedFifth
AugmentedFifth / CircularBuffer.js
Created July 18, 2017 05:00
Efficient, pure Javascript circular buffer implementation supporting both Arrays and TypedArrays that presents interfaces for cons-style, LIFO, FIFO, and ordinary indexing.
/**
* Creates a new `CircularBuffer` with the specified `capacity`,
* which must strictly be a positive integer.
*
* We here use the term "zero element", which refers to exactly `null` if the
* `CircularBuffer` is backed by an `Array`, and refers to exactly `0` if it is
* backed by a `TypedArray`. Note that using this constructor will always yield
* a `CircularBuffer` backed by an `Array`. Use the
* `CircularBuffer.fromArray()` function any time a `TypedArray` backing is
* required.
@CMCDragonkai
CMCDragonkai / socat_early_terminating_server.sh
Last active June 25, 2024 08:53
Socat: HTTP Server that Terminates Early (useful for testing downstream service robustness)
#!/usr/bin/env bash
# change the sleep time appropriately
# this server is persistent
# mix and match with Content-Length and having larger and less content then
# is actually produced
# as well as malformed Chunked Encoding
socat \
-v -d -d \