Skip to content

Instantly share code, notes, and snippets.

@Zerophase
Zerophase / main.cpp
Created January 5, 2020 20:52
SDL2 Unreal start up sample code.
#include <iostream>
#include <SDL.h>
int main()
{
// uint32_t windowStyleSDL = SDL_WINDOW_VULKAN;
SDL_SetHint("SDL_VIDEO_X11_REQUIRE_XRANDR", "1"); // workaround for misbuilt SDL libraries on X11.
// SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_SHOW_CURSOR, "1"); // When relative mouse mode is acive, don't hide cursor.
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "0"); // Don't warp the cursor to the center in relative mouse mode.
@Zerophase
Zerophase / linux-ck.preset
Created May 30, 2019 03:44
minimal initramfs without udev
# mkinitcpio preset file for the 'linux-ck' package
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux-ck"
PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux-ck.img"
default_options="-S udev,block,mdadm_udev,filesystems,keyboard,fsck,consolefont"
int any_bit_eq_1(int x)
{
return !!(x & 0xFFFFFFFF);
}
int any_bit_eq_0(int x)
{
return !!(~x & 0xFFFFFFFF);
}
@Zerophase
Zerophase / .vimrc
Created March 6, 2018 22:20
Vim config
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>" Last change: 2016 Apr 05
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
@Zerophase
Zerophase / override.css
Created September 30, 2017 03:52
Arch css override.
td[style='backgroud: #afa; color: inherit; vertical-align: middle; text-align: center;'] {
background: #006400 !important;
color: red;
}
@Zerophase
Zerophase / record-installedpkgs-post.hook
Last active September 26, 2017 06:23
Record explicitly installed packages
[Trigger]
Operation = Install
Type = Package
Target = *
[Action]
When = PostTransaction
Exec = /etc/pacman.d/scripts/record-installedpkgs.sh -u
NeedsTargets
@Zerophase
Zerophase / applet.js
Created August 4, 2017 16:08
Collapsible System Tray
const Applet = imports.ui.applet;
const Lang = imports.lang;
const Main = imports.ui.main;
const Gtk = imports.gi.Gtk;
const Settings = imports.ui.settings;
const PopupMenu = imports.ui.popupMenu;
const Mainloop = imports.mainloop;
const Util = imports.misc.util;
const St = imports.gi.St;
const GLib = imports.gi.GLib;
@Zerophase
Zerophase / CMakeLists.txt
Created April 10, 2017 23:10
example of precompiled header for clion
ADD_LIBRARY(PCH STATIC stdafx.cpp stdafx.h)
ADD_CUSTOM_COMMAND(TARGET PCH
PRE_BUILD
COMMAND ${CMAKE_CXX_COMMAND} -x c++-header ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h -o stdafx.h.pch)
SET_SOURCE_FILES_PROPERTIES(stdafx.cpp
PROPERTIES
COMPILE_FLAGS "-include stdafx.h")
//..
ADD_EXECUTABLE(ProjectFiles ${SOURCE_FILES})
DialogueClass::DialogueClass()
{
var db = new SomeDb(); // The actual code would look way different, but essentially be doing this
// before this get relevant table for dialogue this dialogue
// and only loop through table ids referencing this dialogue
for(int i = 0; i != db.TextTable.count; ++i) // iterate through rows
{
string nodeId = db.table[i].nodeId;
string textId = db.table[i].textId;
@Zerophase
Zerophase / convert_to_sqlite.cpp
Last active December 22, 2016 06:25
Need to convert to sqlite.
typedef TFunction<FName(void)> Lambda;
Lambda c_0 = [this](void)->FName{ return (gameTime->Hour() < 19) ? TEXT("0x01000001000000D4") : TEXT("0x01000001000000E2"); };