Skip to content

Instantly share code, notes, and snippets.

View nonchip's full-sized avatar
‼️
this is mostly to read/fork/archive. same name on gitlab because fuck microsoft.

Kyra Zimmer nonchip

‼️
this is mostly to read/fork/archive. same name on gitlab because fuck microsoft.
View GitHub Profile
@nonchip
nonchip / build.xml
Last active May 3, 2018 15:51
Lilith's Throne ant file.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="main" name="LilithsThrone" xmlns:fx="javafx:com.sun.javafx.tools.ant">
<!--
USAGE: create a folder for the game, then put this file as `build.xml` into it.
to build the game just run `ant` inside the folder (no more messing with git and eclipse yourself).
to run the game just run `java -jar LilithsThroneGit.jar` inside the folder.
LICENSE: I sincerely don't care. apply MIT, WTFPL, copyleft, or public domain as you see fit.
But please seriously consider supporting Innoxia for making this awesome game.
To do so go to https://www.patreon.com/innoxia
-->
@nonchip
nonchip / bvirtpkg_read.c
Last active March 13, 2018 09:38
a xbps virtual packages list parser for dxpb
#define _POSIX_C_SOURCE 200809L
#include <czmq.h>
#include <stdio.h>
// you'll need to `free` the living shit out of everything in this hash when destroying it!
zhash_t *bvirtpkg_read(const char * path) {
zhash_t *retVal = zhash_new();
// if argument is already a complete path to the file, set to `0` or remove `if` block.
#if 1

Cuda and current compilers

NVidia is archaic as f..., so they don't officially support any current compiler.

but I found a bunch of ugly hacks to make it work with:

  • gcc 7.3.0
  • cuda 9.1.85_387.26
    • install from the .run file with argument --override so it asks you if you're ok with having an unsupported system instead of failing because you're not using ages old ubuntu :P
    • install the CUDA toolkit, but not the (often older than OS provided) GPU driver and not the examples.
    • also install to /opt/cuda-9.1 because your're not your package manager and it doesn't belong into /usr/!
  • then comment out line 121 of /opt/cuda-9.1/include/crt/host_config.h (the one #erroring about unsupported gcc version)
@nonchip
nonchip / export-v4l2-settings.sh
Created January 21, 2018 04:29
outputs a `v4l2-ctl -c` command that sets the current settings for /dev/video0, useful to put the output into `/etc/rc.local` or the likes to make it set up your preferred settings on boot
echo v4l2-ctl -c $(v4l2-ctl --all -k | grep -E '\(int)|\(menu)|\(bool)' | sed -E 's/^ *//;s/^([^ ]*).*value=([^ ]*).*/\1=\2/' | tr '\n' , | head -c -1)
@nonchip
nonchip / pins.h
Created January 15, 2018 02:18
tm1640 and libftdi based clock and system status display
#define PIN_TX 0x01 /* Orange wire on FTDI cable */
#define PIX_RX 0x02 /* Yellow */
#define PIN_RTS 0x04 /* Green */
#define PIN_CTS 0x08 /* Brown */
#define PIN_DTR 0x10
#define PIN_DSR 0x20
#define PIN_DCD 0x40
#define PIN_RI 0x80
@nonchip
nonchip / createDMPmodcontrol.zsh
Last active September 28, 2017 11:19
a DarkMultiPlayer ModControl generator for the shell
#!/bin/zsh
#this builds DMP modcontrol lists.
#without the need to run KSP and click through DMP menus.
#and it's even better at it than DMP itself (which is too lazy to sha256sum) :P
#license: MIT (see generated file or the lines starting with "#copyright" below)
#configure here; then run it (prints to stdout):
GameFolder="$HOME/.steam/steam/steamapps/common/Kerbal Space Program"
additionalWhiteList=""
@nonchip
nonchip / nginx.conf
Last active July 7, 2017 07:49
generate https SNI terminating reverse proxy config for nginx + acmetool (note: everything in /etc/nginx/)
user nginx;
worker_processes 10;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@nonchip
nonchip / div.c
Created June 30, 2017 17:02 — forked from evilscientress/div.c
divides stuff by 12 to test other stuff
#include <stdio.h>
void main(void){
for(int i=-13;i<=13;i++){
int iresult=i/12;
float fresult=((float)i)/12.0f;
printf("%d\t%d\t%d\t%f\n",i,iresult,((int)fresult),fresult);
}
}
@nonchip
nonchip / div.c
Created June 30, 2017 11:54
divides stuff by 12 to test other stuff
#include <stdio.h>
void main(void){
for(int i=-13;i<=13;i++){
int iresult=i/12;
float fresult=((float)i)/12.0f;
printf("%d\t%d\t%d\t%f\n",i,iresult,((int)fresult),fresult);
}
}
@nonchip
nonchip / nvidia-customfan
Last active January 19, 2018 20:11
set the nvidia fan speed to a custom value (optionally derived from the current temperature)
#!/bin/zsh
if [ "_$1" = "_-auto" ]
then nvidia-settings -a '[gpu:0]/GPUFanControlState=0'
elif [ "_$1" = "_-temp" ]
then nvidia-settings -a '[gpu:0]/GPUFanControlState=1'
temp=$(nvidia-settings -tq '[gpu:0]/GPUCoreTemp')
target=$((($temp*$2)/100))
if [ ! "_$3" = "_" ]