Skip to content

Instantly share code, notes, and snippets.

@Xsoda
Xsoda / customer.el
Created August 25, 2022 03:06
emacs prelude personal configure
(disable-theme 'zenburn)
(prelude-require-package 'base16-theme)
(setq prelude-theme 'base16-monokai)
(prelude-require-package 'smart-comment)
(global-set-key (kbd "M-;") 'smart-comment)
(global-set-key (kbd "C-c m") 'smart-comment-mark-line)
(global-set-key (kbd "C-c c") 'smart-comment-cleanup)
(when (version<= "26.0.50" emacs-version)
#include <imgui.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
// Force-directed graph drawing
typedef struct _edge edge_t;
@Xsoda
Xsoda / introrx.md
Last active August 25, 2022 03:19 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
/*
* C11 <threads.h> emulation library
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef EMULATED_THREADS_H_INCLUDED_
#define EMULATED_THREADS_H_INCLUDED_
@Xsoda
Xsoda / gist:3916700
Created October 19, 2012 07:19
bitmap
#include <limit.h> /* for CHAR_BIT */
#include <stdint.h> /* for uint32_t */
typedef uint32_t word_t;
enum { BITS_PER_WORD = sizeof(word_t) * CHAR_BIT };
#define WORD_OFFSET(b) ((b) / BITS_PER_WORD)
#define BIT_OFFSET(b) ((b) % BITS_PER_WORD)
void set_bit(word_t *words, int n) {
words[WORD_OFFSET(n)] |= (1 << BIT_OFFSET(n));
@Xsoda
Xsoda / gist:3910041
Created October 18, 2012 05:37
odbcsql
/*******************************************************************************
/* ODBCSQL: a sample program that implements an ODBC command line interpreter.
/*
/* USAGE: ODBCSQL DSN=<dsn name> or
/* ODBCSQL FILEDSN=<file dsn> or
/* ODBCSQL DRIVER={driver name}
/*
/*
/* Copyright(c) Microsoft Corporation. This is a WDAC sample program and
/* is not suitable for use in production environments.
@Xsoda
Xsoda / sqlite3.c
Created August 14, 2012 01:36
sqlite3_prepare
#include <sqlite3.h>
void exec(sqlite3* db, const char* sql)
{
sqlite3_stmt* stmt;
if (sqlite3_prepare(db, sql, strlen(sql), &stmt, NULL) == SQLITE_OK)
{
sqlite3_step(stmt);
}
else
{
@Xsoda
Xsoda / gist:3161979
Created July 23, 2012 04:37
Python Parse Jindong Computer infomation.
#!/usr/bin/env python
# author: Cedric Porter [ Stupid ET ]
# contact me: cedricporter@gmail.com
from urllib import urlopen
import threading
import re
import Queue
def get_info(url):
@Xsoda
Xsoda / gist:3120099
Created July 16, 2012 02:46
using stdout in GUI programs
/**
* The following function shows one way that a GUI application can redirect the stdout
* stream to a new console window. After the following function has been called, the
* GUI program can use C runtime functions like printf to display information on the
* console window. This can be useful during debugging.
*/
// Version 1: