Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
gcc -m32 test.c -o test-32bit
./test-32bit
#include <stdio.h>
int main() {
printf ("Hello World!\n");
return 0;
}
@sumjha
sumjha / CheckEnv.go
Created June 4, 2020 07:44
Check if a environment variable is set in Go (Golang)
package main
import (
"fmt"
"os"
)
func main() {
val, present := os.LookupEnv("MyEnvVariable")
fmt.Printf("MyEnvVariable env variable present: %t\n", present)
@sumjha
sumjha / autoscaler.js
Created April 30, 2019 06:16
Sample node.js script to post data to custom metric api endpoint of SAP Cloud Platform's Auto Scaler Service
var request = require("request");
var cfenv = require("cfenv")
var appEnv = cfenv.getAppEnv()
var as_cred = appEnv.getServiceCreds('as');
var custom_metric_url = as_cred.custom_metrics.url+'/v1/apps/'+process.env.CF_INSTANCE_GUID+'/metrics',
auth = "Basic " + Buffer.from(as_cred.custom_metrics.username+ ":" +as_cred.custom_metrics.password).toString("base64");
console.log('user name ='+as_cred.custom_metrics.username)
console.log('password ='+ as_cred.custom_metrics.password)
#include <stdio.h>
static int* INITIAL_STATE = new int(13);
void printInitialState()
{
printf("INITIAL_STATE=%d",*INITIAL_STATE);
}