Skip to content

Instantly share code, notes, and snippets.

@jampajeen
jampajeen / delete_unused_docker_images.sh
Created June 3, 2023 16:20
Delete unused docker images
View delete_unused_docker_images.sh
docker rmi $(docker images -f "dangling=true" -q)
@jampajeen
jampajeen / nvidia-gt710-arm-pi-setup.sh
Created July 4, 2021 07:56 — forked from geerlingguy/nvidia-gt710-arm-pi-setup.sh
Set up the Nvidia GeForce GT 710 on Raspberry Pi Compute Module 4
View nvidia-gt710-arm-pi-setup.sh
#!/bin/bash
# Attempt to set up the Nvidia GeForce GT 710 on a Pi CM4.
#
# I have tried both armv7l and aarch64 versions of the proprietary driver, in
# addition to the nouveau open source driver (which needs to be compiled into
# a custom Raspberry Pi kernel).
#
# tl;dr - None of the drivers worked :P
@jampajeen
jampajeen / index.html
Created March 21, 2021 10:44 — forked from hpcslag/index.html
Image Recognize in Golang
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="/recognize" method="post" enctype="multipart/form-data">
@jampajeen
jampajeen / git-pushing-multiple.rst
Created February 20, 2021 13:13 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.
View git-pushing-multiple.rst

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@jampajeen
jampajeen / go-call-c-lib
Created February 13, 2021 08:10
Golang call C function in dynamic library using dlopen
View go-call-c-lib
package cv
import "C"
import (
"log"
"github.com/rainycape/dl"
)
// Capture ...
@jampajeen
jampajeen / gist:d19f36a7309d0ead0e1f9735a26d66f3
Created January 12, 2021 15:35
Disable/Enable Mac OSX sleep on lid closed
View gist:d19f36a7309d0ead0e1f9735a26d66f3
# disable sleep
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1
# re-enable sleep
sudo pmset -b sleep 5; sudo pmset -b disablesleep 0
@jampajeen
jampajeen / nats-cluster-healthcheck.yml
Created August 9, 2020 17:14
docker-compose nats steaming cluster healthcheck
View nats-cluster-healthcheck.yml
healthcheck:
test: echo $$(wget --server-response http://node1:8222/varz 2>&1 | grep '200 OK') | grep '200' || exit 1
interval: 20s
timeout: 5s
retries: 5
start_period: 40s
@jampajeen
jampajeen / nestjs-mongoose-uuid
Created June 3, 2020 13:57
Nestjs mongoose use UUID as an id
View nestjs-mongoose-uuid
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { v4 as uuidv4 } from 'uuid';
@Schema()
export class Course extends Document {
@Prop({ type: String, default: function genUUID() {
return uuidv4()
}})
@jampajeen
jampajeen / nesjs-typeorm-uuid-pk
Last active June 3, 2020 13:55
Nestjs TypeORM auto generate UUID as a primary key
View nesjs-typeorm-uuid-pk
@Entity()
export class User {
@PrimaryGeneratedColumn("uuid")
id: string;
}
@jampajeen
jampajeen / nosleep.sh
Created November 27, 2019 14:42
Completely disable sleep on any Mac
View nosleep.sh
# Useful to prevent Macbooks to go to sleep when closing the lid instead of running tools that requires a Kernel Extension (e.g. InsomniaX) and more
# Before doing anything, save your current configuration using
pmset -g
# To disable sleep
sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1;
# And to go back to normal
sudo pmset -a sleep 1; sudo pmset -a hibernatemode [original hibernatemode value]; sudo pmset -a disablesleep 0;