Skip to content

Instantly share code, notes, and snippets.

View sumantro93's full-sized avatar

Sumantro Mukherjee sumantro93

View GitHub Profile
@sumantro93
sumantro93 / c
Created August 21, 2023 09:40
duktape_basic.c
#include <stdio.h>
#include <duktape.h>
static duk_ret_t native_print(duk_context *ctx) {
printf("%s\n", duk_to_string(ctx, 0));
return 0; // No return value (= undefined)
}
int main(int argc, char *argv[]) {
duk_context *ctx = duk_create_heap_default();
@sumantro93
sumantro93 / cpp
Created August 21, 2023 08:49
conversion_test.cpp
#include <double-conversion/double-conversion.h>
#include <iostream>
int main() {
double number = 12345.6789;
char buffer[100];
double_conversion::StringBuilder builder(buffer, sizeof(buffer));
double_conversion::DoubleToStringConverter converter(
double_conversion::DoubleToStringConverter::NO_FLAGS,
@sumantro93
sumantro93 / txt
Last active August 27, 2023 09:55
Crit-path package test case
PackageKit : https://fedoraproject.org/wiki/QA:Testcase_pkcon
NetworkManager : https://fedoraproject.org/wiki/QA:Testcase_networkctl
Nmcli : https://fedoraproject.org/wiki/QA:Testcase_nmcli
accountsservice : https://fedoraproject.org/wiki/QA:Testcase_accountsservice
acl: https://fedoraproject.org/wiki/QA:Testcase_acl
aha: https://fedoraproject.org/wiki/QA:Testcase_aha
alsa-lib : https://fedoraproject.org/wiki/QA:Testcase_alsa
alternatives : https://fedoraproject.org/wiki/QA:Testcase_alternatives
anthy-unicode : https://fedoraproject.org/wiki/QA:Testcase_anthy_unicode
appres : https://fedoraproject.org/wiki/QA:Testcase_appres
@sumantro93
sumantro93 / txt
Created August 17, 2023 16:00
.destop_file_create
Creating a .desktop file involves creating a plain text file with a specific format and saving it with a .desktop extension. These files are used in Linux and other Unix-like systems to define how a particular program is to be launched, how it appears in menus, etc. Here's how you can create a simple .desktop file:
Open a Text Editor:
Open your favorite text editor; this could be gedit, nano, vi, etc. You can usually open a text editor from your applications menu or from the terminal.
gedit or nano
Enter the Desktop File Content:
In the text editor, you need to enter the content for the .desktop file. Below is a simple example:
#include <stdio.h>
#include <dbus/dbus.h>
#include <stdlib.h>
#include <unistd.h>
void send_signal(DBusConnection *conn) {
DBusMessage *msg;
DBusMessageIter args;
msg = dbus_message_new_signal("/com/example/TestObject", // object name
@sumantro93
sumantro93 / c
Last active August 14, 2023 12:31
dbus_example.c
#include <stdio.h>
#include <dbus/dbus.h>
#include <stdlib.h>
#include <unistd.h>
void send_signal(DBusConnection *conn) {
DBusMessage* msg;
DBusMessageIter args;
msg = dbus_message_new_signal("/test/signal/Object", "test.signal.Type", "Test");
@sumantro93
sumantro93 / c
Created August 13, 2023 10:17
test_cairo.c
#include <cairo.h>
#include <cairo-gobject.h>
int main() {
cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 240, 80);
cairo_t *cr = cairo_create(surface);
cairo_select_font_face(cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr, 32.0);
cairo_set_source_rgb(cr, 0.0, 0.0, 1.0);
@sumantro93
sumantro93 / c
Last active August 13, 2023 04:48
c-ares
#include <stdio.h>
#include <ares.h>
#include <arpa/inet.h>
#include <netdb.h>
void callback(void *arg, int status, int timeouts, struct hostent *host) {
if (status == ARES_SUCCESS) {
char ip[INET6_ADDRSTRLEN];
int idx;
@sumantro93
sumantro93 / cpp
Created August 13, 2023 04:09
Boost C++ test case for libs
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/thread.hpp>
#include <boost/atomic.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/null.hpp>
// Atomic counter
boost::atomic<int> counter(0);
@sumantro93
sumantro93 / lightupthedarkplace.ino
Created April 12, 2017 04:18
PIR sensor for Arduino UNO
/*
* //////////////////////////////////////////////////
* //making sense of the Parallax PIR sensor's output
* //////////////////////////////////////////////////
*
* Switches a LED according to the state of the sensors output pin.
* Determines the beginning and end of continuous motion sequences.
*
* @author: Kristian Gohlke / krigoo (_) gmail (_) com / http://krx.at
* @date: 3. September 2006