Skip to content

Instantly share code, notes, and snippets.

View Taymindis's full-sized avatar
🏠
Working from home

Taymindis Woon Taymindis

🏠
Working from home
View GitHub Profile

To access the api in this example, first we have to procure the Auth Token (using one of the OAuth2 Flows) containing a scope "canGreet".

Assumption is that the Authorization Server supports OpenId Connect 1.0 specifications.

@rampfox
rampfox / Chromium-at-startup.md
Last active May 6, 2024 14:27
How to open Chromium in full screen at startup on the Raspberry Pi

First, it seems that ~/.config/lxsession/LXDE-pi/autostart does not exist by default.

  1. copy the autostart
cp /etc/xdg/lxsession/LXDE-pi/autostart ~/.config/lxsession/LXDE-pi/
@shankarshastri
shankarshastri / LearnXInYMinProtocolBuffer.proto
Last active February 2, 2024 03:18
Self-Explanatory Protocol Buffer Lang Guide (CheatSheet)
/*
* Self-Explanatory Protocol Buffer Lang Guide
*/
/*
* Why Protocol Buffers?
* Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.
* You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.
* Protocol Buffers are Schema Of Messages. They are language agnostic.
@Taymindis
Taymindis / spdlog_stream_route_handler.cpp
Last active July 7, 2018 03:46
stream route handler with spdlog
#include <iostream>
#include <stream_rt_handler.h>
/*https://github.com/gabime/spdlog*/
#include "spdlog/spdlog.h"
/***Compile by ***/
/** cd build **/
/** g++ -DSPDLOG_FMT_PRINTF -std=c++11 ../sample_with_spdlog.cpp -lsrh -pthread **/
@petitviolet
petitviolet / nginx_deployment.yaml
Created March 11, 2018 11:04
sample Nginx configuration on Kubernetes using ConfigMap to configure nginx.
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
@bmaupin
bmaupin / free-backend-hosting.md
Last active May 3, 2024 18:14
Free backend hosting
@Taymindis
Taymindis / multithread_test_zone.c
Created September 15, 2017 01:56
MultiThreading read and write for Hazard Pointer Logic in C
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#define THREAD_RUN 100
typedef struct $
{
char s[50];
} concurrent_update;
@rafaeltuelho
rafaeltuelho / camel-raw-oauth.java
Created January 18, 2017 12:47
camel snippet using oauth to get an auth token and use it to request a secured rest service
from("timer://scheduler?period=30s")
.log("get access token")
.to("direct:authService");
from("direct:authService").tracing()
.setHeader(Exchange.HTTP_PATH)
.simple("<auth service context>/oauth2/token")
.setHeader("CamelHttpMethod")
.simple("POST")
.setHeader("Content-Type")
@EtienneR
EtienneR / user.js
Created January 7, 2016 23:39
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@ralavay
ralavay / vim-nginx-conf-highlight.sh
Last active April 21, 2024 03:58
Enable syntax highlight for Nginx conf file in Vim
#!/bin/bash
#
# Highligh Nginx config file in Vim
# Download syntax highlight
mkdir -p ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim
# Set location of Nginx config file
cat > ~/.vim/filetype.vim <<EOF