Skip to content

Instantly share code, notes, and snippets.

@barosl
barosl / add.c
Created July 26, 2015 07:26
Function overloading in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int addi(int a, int b) {
return a + b;
}
char *adds(char *a, char *b) {
char *res = malloc(strlen(a) + strlen(b) + 1);
@wutipong
wutipong / sdl_render-text-with-direction.cpp
Last active October 1, 2024 07:54
SDL Render text with Freetype and harfbuzz, using outline render.
#include <iostream>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_OUTLINE_H
#include <SDL2/SDL.h>
#include <SDL2/SDL_main.h>
#include <string>
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active March 5, 2026 13:34
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@GaryLee
GaryLee / dropbtn.qml
Created November 13, 2015 05:15
QML Button which allow drop file to it.
Button {
id: button1
width: 230
height: 179
text: 'drag file to me'
DropArea {
id: fileDropArea
anchors.fill: parent
onEntered: {
drag.accept (Qt.CopyAction);
@lopspower
lopspower / README.md
Last active January 20, 2024 09:18
Publish AAR to jCenter and Maven Central

Publish AAR to jCenter and Maven Central

Twitter

EDIT: You can find this same updated tutorial here -> Medium

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView
@evantoli
evantoli / GitConfigHttpProxy.md
Last active March 12, 2026 09:22
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@bkaradzic
bkaradzic / orthodoxc++.md
Last active April 27, 2026 06:43
Orthodox C++

Orthodox C++

This article has been updated and is available here.

@edolstra
edolstra / nix-ui.md
Last active August 16, 2025 00:03
Nix UI

General notes

  • nix-channel and ~/.nix-defexpr are gone. We'll use $NIX_PATH (or user environment specific overrides configured via nix set-path) to look up packages. Since $NIX_PATH supports URLs nowadays, this removes the need for channels: you can just set $NIX_PATH to e.g. https://nixos.org/channels/nixos-15.09/nixexprs.tar.xz and stay up to date automatically.

  • By default, packages are selected by attribute name, rather than the name attribute. Thus nix install hello is basically equivalent to nix-env -iA hello. The attribute name is recorded in the user environment manifest and used in upgrades. Thus (at least by default) hello won't be upgraded to helloVariant.

    @vcunat suggested making this an arbitrary Nix expression rather than an attrpath, e.g. firefox.override { enableFoo = true; }. However, such an expression would not have a key in the user environment, unlike an attrpath. Better to require an explicit flag for this.

TBD: How to deal with search path clashes.

General

Search paths & namepaces

NIX_PATH only of the form: nixpkgs=https://nixos.org…:mypkgs=/home/bar/nixpkgs

then: nix install nixpkgs.pkgs.hello

and nix install mypkgs.pkgs.hello

#!/bin/sh
BGCOLOR='#550000'
TEXTCOLOR='#eeeeee'
TEXTFONT='Ubuntu-Light'
TEXTSIZE=72
TEXT="\nHello this is a very long text\nwrapped in many lines"
# Put screenshot into a frame, change +86+242 if you change a frame PNG
composite -geometry +86+242 $1 frame.png $2