Skip to content

Instantly share code, notes, and snippets.

@donwilson
donwilson / SFML 2.3.2 on Windows with G++
Last active December 9, 2015 19:49
Setup build batch file for SFML 2.3.2 (GCC 4.9.2 MinGW (DW2) - 32-bit) on Windows 10
1) Download GCC 4.9.2 MinGW (DW2) - 32-bit from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-posix/dwarf/i686-4.9.2-release-posix-dwarf-rt_v3-rev0.7z/download (via http://stackoverflow.com/a/28011978)
- Extract to C:\dev_resources\mingw32-4.9.2
2) Download SFML 2.3.2 for GCC 4.9.2 MinGW (DW2) - 32-bit at http://www.sfml-dev.org/download/sfml/2.3.2/
- Extract to C:\dev_resources\SFML-2.3.2_GCC-4.9.2
3) Save compile.bat from this gist into your source directory where main.cpp is
4) (For now) copy "libstdc++-6.dll" from "C:\dev_resources\mingw32-4.9.2\bin\libstdc++-6.dll" into source directory where compile.bat is
5) Run compile.bat in CMD
#include <SFML/Graphics.hpp>
#include <iostream>
#include <stdlib.h>
int main(int argc, char **argv) {
sf::RenderWindow window(sf::VideoMode(800, 600), "test");
sf::CircleShape circle(100.f);
circle.setFillColor(sf::Color::Green);
#!/bin/bash
SOURCE_FILE=$1
if [[ -z "$SOURCE_FILE" ]]; then
SOURCE_FILE="main"
fi
if [[ ! -f "$SOURCE_FILE.cpp" ]]; then
echo "!! $SOURCE_FILE.cpp not found, exiting..."
@donwilson
donwilson / gist:3e863598ce041071be0f
Last active August 29, 2015 14:20
https://twitter.com/Dinnerbone/status/595224755126534144 The following picture is meaningless and is probably not even worth your time clicking on it.
<?php $height = (!empty($_REQUEST['height'])?$_REQUEST['height']:128); ?><style type="text/css">
.image { width: 2px; float: left; background-image: url('http://media.dinnerbone.com/uploads/2015-05/screenshots/04_15-51-30_LLw4sOTM2a.png'); background-position: 0 0; }
</style>
<p><a href="?height=<?=($height-1);?>">Less</a> | <?=$height;?> | <a href="?height=<?=($height+1);?>">More</a></p>
<div style="display: table; width: 100%; height: <?=$height;?>px;"><?php
for($i = 1; $i <= 427; $i++) { ?><div class="image" style="height: <?=$height;?>px; background-position: 0 -<?=($height * ($i - 1));?>px;"></div><?php }
?></div>
@donwilson
donwilson / minecraft
Last active August 29, 2015 14:20
Minecraft service startup script for CentOS/etc with backup command to that can upload .tar.gz of your minecraft folder/world to Amazon S3 through s3cmd.
#!/bin/bash
# /etc/init.d/minecraft
# version 0.5.0 2015-04-20 (YYYY-MM-DD)
#
### BEGIN INIT INFO
# Provides: minecraft
# Required-Start: $local_fs $remote_fs screen-cleanup
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
@donwilson
donwilson / wikimedia_dump_sync.php
Last active August 29, 2015 14:20
An automated Wikipedia data dump downloader written in PHP. This tool checks for the latest complete English Wikipedia data dump and automatically downloads, extracts, and stores articles into individual files for fast reads. Optionally stores relevant info into an 'articles' mysql database table.
<?php
set_time_limit(0);
ini_set('memory_limit', "1024M");
// encoding settings
try {
setlocale(LC_ALL, 'en_US.UTF8');
mb_internal_encoding("UTF-8");
} catch(Exception $e) { die("Unable to set local/internal encoding"); }