Skip to content

Instantly share code, notes, and snippets.

View Swyter's full-sized avatar
💭
¯\_(ツ)_/¯

Swyter Swyter

💭
¯\_(ツ)_/¯
View GitHub Profile
document.createElement_=document.createElement;
document.createElement=function()
{
var thing = (arguments.callee.caller.toString().indexOf('banner_ad') !== -1); console.log(thing);
thing && document.createElement_.apply(this, arguments);
}
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int is_palindrome(char *str)
{
char *last = str + strlen(str) - 1;
unsigned int half = strlen(str) / 2;
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
int inspect_bits(unsigned int number)
{
if (!((number & 0xAAAAAAAA) && /* populated even and odd fields, else bail out */
(number & 0x55555555)))
return 0;
@Swyter
Swyter / text_edb_dump.txt
Last active November 30, 2016 14:59
Sphinx and the Cursed Mummy Standalone Demo -- «text.edb» dump (Dumped with this Python script: https://github.com/Swyter/sphinxtools/commit/9f15da156b7cadca3bc6a9ce0378045bd7eb2a08)
b'MOEG' 1297040711 1297040711
14000002 0 0 2096 0 1
14000003 0 1 2108 0 1
14000004 0 2 2072 0 1
14000005 0 3 2084 0 1
14000006 0 4 2060 0 1
1400000c 0 5 2120 0 1
1400000d 0 6 2048 0 1
{1: 335544322, 2: 335544323, 3: 335544324, 4: 335544325, 5: 335544326, 6: 335544332, 7: 335544333}
-> 1 1000
@Swyter
Swyter / gist:a4a59df4aaf38d3607d19d951554fc9c
Created December 8, 2016 22:53
signed distance fonts
[swyter@osgiliath sdfgen-master]$ ./sdfgen ~/tldmod-git/_tld_fullfont_porcuatro_0-RGBA.png thing.png --verbose --maxdst 80
Loading input image '/home/swyter/tldmod-git/_tld_fullfont_porcuatro_0-RGBA.png'.
Image is of size 8192x8192 pixels.
Converting image to binary.
Calculating Mipmap.
Mipmap has 14 levels.
Calculating signed distance field of size 2048 with saturation distance 80
Doing a final color space conversion.
Saving signed distance field image in png format as 'thing.png'.
[swyter@osgiliath sdfgen-master]$ ./sdfgen ~/tldmod-git/_tld_fullfont_porcuatro_0-RGBA.png thing.png --verbose --maxdst 80
<div style="background-color: rgba(255, 140, 0, 0.72); z-index: 999; position: absolute; padding: 8px; border-radius: 3px; color: darkred; font-size: 2em; font-weight: bold; width: 924px; margin-top: -18px;"><a href="https://tldmod.github.io/" target="_blank" title="Hey there! We've made this page to streamline the process of finding and installing the latest everything, we know it isn't easy to follow what's going on, so this is our small gift to you. A nice and small presentation page with the key facts, with just what you need." style="color: darkred !important; text-decoration: none;">Click here to find and install the latest patches, including nightlies! <em>—TLD Team</em></a></div>
<br /><div style="width: 940px; height: 470px; background-image: url('http://media.moddb.com/images/members/1/551/550824/swy.tld.first.try2.jpg'); margin-top: -35px; margin-bottom: -10px;"><br />
<div style="color: black; font-family: georgia,sans-serif; font-size: 1.1em; position: absolute; top: 134px; left: 40px; width: 800
# This is a sample build configuration for other languages.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Dockerhub as your build environment.
image: pritunl/archlinux
pipelines:
default:
- step:
script:
@Swyter
Swyter / obenkyo_obe_to_json.py
Last active February 19, 2017 01:15
obenkyo_obe_to_json.py
# created on 2017-02-18 by swyter, should work in most circumstances
# data is correctly sorted and normalized, getting rid of most of the original format's kinks
# USAGE: run this python2 script in the same folder of your '*.obe' exports, their readable json counterparts will appear under the './json' sub-folder
import sys
# use utf-8 encoding on windows, too
reload(sys); sys.setdefaultencoding("utf-8")
[quote author=Khamukkamu link=action=profile;u=178899 date=1487510167]
Thanks for your reply. Yea, i'm afraid of touching AI cause it can do so much harm.
I have another unrelated question, it is more of a 'programming' type of question, cause i really feel like this could be done better/more elegantly:
Goal: Don't let the scout camp spawn on water, mountains, river.
[spoiler][code]
(assign, ":terrain_check", 0), # Check if spawned camp is not in weird terrain
(try_for_range, ":iterate", 0, 10),