Skip to content

Instantly share code, notes, and snippets.

@atrauzzi
atrauzzi / google-cloud-run-get-project-hash.sh
Last active May 25, 2023 00:41
Google Cloud Run Get Project Hash
#!/bin/bash
PROJECT=${1:-"$(gcloud config get-value project)"}
REGION=${2:-"us-central1"}
IMAGE="hub.docker.com/_/nginx"
{
gcloud services enable "run.googleapis.com" --project="${PROJECT}"
gcloud auth configure-docker --quiet
@yungwarlock
yungwarlock / main.dart
Last active June 26, 2023 14:24
Dart Timer
import 'dart:async';
void main() {
int countDown = 60;
bool shouldShowResend = false;
Timer.periodic(const Duration(seconds: 1), (t) {
print(formatTime(countDown));
print(shouldShowResend);
});
@tscho
tscho / unix_server.c
Created May 11, 2010 16:57
An example of a unix socket echo server that can run as a daemon
#include <signal.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <sys/un.h>
#include <errno.h>
#include <sys/signal.h>
#include <wait.h>
@m-decoster
m-decoster / webgl.dart
Last active September 4, 2023 09:05
A simple WebGL application in Dart to get you started.
library webglapp;
import 'dart:typed_data';
import 'dart:html';
import 'dart:web_gl';
import 'dart:async';
CanvasElement canvas = document.getElementById("gameCanvas");
RenderingContext gl;
@yungwarlock
yungwarlock / main.dart
Last active September 4, 2023 13:26
SchedulerBinding
import 'package:flutter/material.dart';
import "package:flutter/scheduler.dart";
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@michal-wrzosek
michal-wrzosek / api.Dockerfile
Created December 3, 2019 02:05
yarn workspaces and Docker
FROM node:10-alpine as build
WORKDIR /usr/src/app
COPY package.json .
COPY yarn.lock .
COPY packages/shared ./packages/shared
COPY packages/api ./packages/api
RUN yarn install --pure-lockfile --non-interactive
@henridf
henridf / protoc-encode.md
Last active January 20, 2024 14:16
Encoding a protobuf with `protoc --encode`

I needed to quickly encode a protobuf from the command-line, and while I pretty much immediately came across protoc --encode as the obvious solution, I did not find much documentation on the input textual syntax.

Here is the relevant snippet from protoc --help:

--encode=MESSAGE_TYPE       Read a text-format message of the given type
                              from standard input and write it in binary
                              to standard output.  The message type must
                              be defined in PROTO_FILES or their imports.
@shyd
shyd / Dockerfile
Last active January 21, 2024 01:56
install locales inside a docker image
FROM debian
RUN apt-get update && \
apt-get install -y \
locales && \
rm -r /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales
@roachhd
roachhd / PART-ONE.md
Last active January 22, 2024 12:08
Trello API - the full docs.

Getting Started — Trello documentation

Introduction

Trello provides a simple [RESTful][1] web API where each type of resource (e.g. a card, a board, or a member) has a URI that you can interact with.

For example, if you'd like to use the API to get information about the [Trello Development board][2], you'd use the following URI:

https://api.trello.com/1/boards/4d5ea62fd76aa1136000000c
@nmilosev
nmilosev / edit-init-rc.md
Created May 27, 2018 21:31 — forked from ashutosh-mishra/edit-init-rc.md
How to run custom script from init.rc, How to Extract Android Kernel And Modify The Boot Ramdisk(Android 4+)

init.rc changes

init.rc changes to run any script Can be used to start any android application, service

on property:dev.bootcomplete=1
    exec - system system -- /system/bin/sh <custom script path>
    # exec - system system -- /system/bin/sh /data/local/bootscript/testservice.sh

Script can contains applications start, stop commands