Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Philip Whitfield underdoeg

💭
I may be slow to respond.
View GitHub Profile
@underdoeg
underdoeg / circle.gd
Last active Jul 22, 2020
Draw a circle within Godot
View circle.gd
tool
extends Control
var color_internal:Color = Color.red
export var color:Color = color_internal setget _set_color, _get_color
var res_internal:int = 50
export var resolution:int = res_internal setget _set_resolution, _get_resolution
@underdoeg
underdoeg / PKGBUILD
Created Jan 26, 2020
Figaro's Password Manager 2 beta aur build
View PKGBUILD
# Contributor: TDY <tdy@gmx.com>
pkgname=fpm2
pkgver=0.90dev2
pkgrel=1
pkgdesc="Figaro's Password Manager 2"
arch=('i686' 'x86_64')
url="http://als.regnet.cz/fpm2/"
license=('GPL')
depends=('gtk2')
@underdoeg
underdoeg / PKGBUILD
Last active Jan 24, 2020
godot 3.2 beta PKGBUILD
View PKGBUILD
# Maintainer: Ivan Fonseca <ivanfon@riseup.net>
# Modified by: Philip Whitfield <public@underdoeg.com>
pkgname=godot-beta-bin
pkgver=3.2_rc3
pkgrel=1
pkgdesc="The latest official beta release of the Godot game engine"
url="https://godotengine.org"
license=("MIT")
arch=("i686" "x86_64")
@underdoeg
underdoeg / mapping.py
Last active Nov 12, 2019
HDE PS2 controller mapping for linux
View mapping.py
from __future__ import print_function
import hid
import time
import uinput
buttons = [
uinput.BTN_START,
uinput.BTN_SELECT,
uinput.BTN_NORTH,
@underdoeg
underdoeg / pam_authenticate.cpp
Created Aug 8, 2019
test user auth with pam on linux
View pam_authenticate.cpp
#include <security/pam_appl.h>
#include <security/pam_misc.h>
#include <string>
int pam_conversation(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) {
auto pass = static_cast<std::string *>(appdata_ptr);
auto reply = (struct pam_response *) malloc(sizeof(struct pam_response));
reply->resp = strdup(pass->c_str());
reply->resp_retcode = 0;
*resp = reply;
@underdoeg
underdoeg / InlineEdit.vue
Created Jun 27, 2018
minimal inline edit vue component
View InlineEdit.vue
<template>
<div class="editable" contenteditable="true" :placeholder="placeholder" @input="update" @focusin="onFocus" @focusout="checkEmpty"></div>
</template>
<script>
export default {
name: "InlineEdit",
props: {
data: String,
placeholder: {
@underdoeg
underdoeg / main.cpp
Created Apr 14, 2017
Convert a tuple of pointers to a tuple of references
View main.cpp
#include <tuple>
#include <iostream>
template<typename ...T, size_t... I>
auto makeReferencesHelper(std::tuple<T...>& t , std::index_sequence<I...>)
{ return std::tie(*std::get<I>(t)...) ;}
template<typename ...T>
auto makeReferences( std::tuple<T...>& t ){
View taggedTuple.cpp
#include <iostream>
#include <brigand/brigand.hpp>
template<typename Members>
class TaggedTuple{
template<typename TagType>
struct createMember{
using type = typename TagType::type;
};
@underdoeg
underdoeg / createKTX.cpp
Created Nov 24, 2016
Create mipmap ktx textures from png files with freetype and gli
View createKTX.cpp
#include <cstring>
#include "cxxopts.hpp"
#include <iostream>
#include "gli/type.hpp"
//#include "gli/texture2d.hpp"
#include "gli/convert.hpp"
#include "gli/copy.hpp"
#include "gli/generate_mipmaps.hpp"
#include "gli/save.hpp"
#include <FreeImage.h>
@underdoeg
underdoeg / main.cpp
Created Aug 5, 2016
Simple property animation with cluttermm
View main.cpp
#include <cluttermm.h>
#include <gdkmm/wrap_init.h>
#include <gdkmm/pixbuf.h>
#include <iostream>
int main(int argc, char *argv[])
{
Glib::init(); //Otherwise Gdk::wrap_init() will fail.