Skip to content

Instantly share code, notes, and snippets.

View Mygod's full-sized avatar
👿
Payment is usually required for a response.

Mygod Mygod

👿
Payment is usually required for a response.
View GitHub Profile
@Mygod
Mygod / chopsticks-leftovers.cpp
Last active April 20, 2016 10:31
Chopsticks game with leftovers rule solver
/**
* Chopsticks game with leftovers rule solver.
* @author Mygod
*/
// Here's a set of rules you can customize:
#define RULE_SPLITS
//#define RULE_SUICIDAL
//#define RULE_TRANSFER
@Mygod
Mygod / nand-nor-minimizer.cc
Created March 16, 2016 15:16
nand-nor-minimizer
/**
* nand-nor-minimizer by Mygod.
*
* Test samples:
* 1000000000000000 NOR(A, B, C, D)
* 1111111111111110 NAND(A, B, C, D)
* 0000000000001110
* 1110111011101111
* 0110011011100000 My stupid assignment
* 0010011101110100 A random test sample
@Mygod
Mygod / convert.bat
Created February 28, 2016 11:42
Convert all JPG to black-and-white PNG in the current directory
@echo off
for /r %%f in (*.jpg) do path\to\ffmpeg -i "%%~pf%%~nf.jpg" -pix_fmt monob "%%~pf%%~nf.png"
pause
@Mygod
Mygod / games.md
Last active June 24, 2017 06:50
Games I love
  • Antichamber
  • Aquaria
  • Braid
  • Epistory - Typing Chronicles
  • FEZ
  • Goat Simulator
  • Indie Game: The Movie
  • Inside
  • LIMBO
  • NightSky HD
@Mygod
Mygod / converter.php
Last active April 21, 2019 03:17
Redirect user to Userscloud free account download link
<form method="POST" action="https://userscloud.com/<?= $id ?>">
<input type="hidden" name="op" value="download2">
<input type="hidden" name="id" value="<?= $id ?>">
<input type="hidden" name="method_premium" value="">
</form>
<iframe src="https://userscloud.com/?op=login&login=solarglacier&password=coolpass" width="0" height="0" style="display: none;" onload="document.getElementsByTagName('form')[0].submit();"></iframe>
@Mygod
Mygod / README.md
Last active August 29, 2015 14:13
DjVu bookmarks exporter
@Mygod
Mygod / gist:7abc15491f2c2df2694a
Last active August 29, 2015 14:07
Update patch generator for customized Drupal, WordPress, etc.
git checkout main-old
git checkout -b main-new
: extract new content here...
git commit -a -m main-new
git checkout -b mine-new
git merge mine-old
git diff mine-old --name-only > patch-files.txt
: If this is the first one, use this:
: git ls-tree --full-tree -r --name-only HEAD > patch-files.txt
7zG a patch.zip @patch-files.txt -mx9
@Mygod
Mygod / gist:cd6efc1524d3f1662b25
Last active August 29, 2015 14:07
A buggy WordPress exporter (it's buggy, don't use it)
(s = document.createElement('script')).setAttribute('src', 'https://mygod.tk/js/jquery/jquery-2.0.3.min.js');
document.getElementsByTagName('head')[0].appendChild(s);
(s = document.createElement('script')).setAttribute('src', 'https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js');
document.getElementsByTagName('head')[0].appendChild(s);
output = [];
itemCount = [];
processedCount = [];
count = (q = $('a[href^="*wordpress*/?p="]')).length;
processed = 0;
@Mygod
Mygod / gist:cdf412dd1020551454be
Created August 14, 2014 13:07
Chinese characters fix for Windows English systems.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"MS PGothic MC"=hex(7):4D,00,53,00,59,00,48,00,2E,00,54,00,54,00,43,00,2C,00,4D,00,69,00,63,00,72,00,6F,00,73,00,6F,00,66,00,74,00,20,00,59,00,61,00,48,00,65,00,69,00,20,00,55,00,49,00,2C,00,31,00,32,00,38,00,2C,00,38,00,35,00,00,00,43,00,3a,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,5c,00,65,00,68,00,6f,00,6d,00,65,00,5c,00,57,00,54,00,56,00,47,00,4f,00,54,00,48,00,49,00,43,00,2d,00,53,00,2e,00,74,00,74,00,63,00,2c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,54,00,56,00,20,00,50,00,47,00,6f,00,74,00,68,00,69,00,63,00,00,00,4d,00,49,00,4e,00,47,00,4c,00,49,00,55,00,2e,00,54,00,54,00,43,00,2c,00,50,00,4d,00,69,00,6e,00,67,00,4c,00,69,00,55,00,00,00,53,00,49,00,4d,00,53,00,55,00,4e,00,2e,00,54,00,54,00,43,00,2c,00,53,00,69,00,6d,00,53,00,75,00,6e,00,00,00,47,00,55,00,4c,00,49,00,4d,00,2e,00,54,00,54,00,43,00,2c,00,47,00,75,00,6c,00,69,00,6d,00,00,00,00,00
"Segoe Media Center
@Mygod
Mygod / gist:f4143a78e0b10ab9ac3a
Created August 11, 2014 09:33
PHP + PostgreSQL Lightweighted Caching
<?
$connection_string = '*insert connection string here*';
$cache_id = 123;
$expiration_seconds = 86400;
function generate_a_huge_string() {
sleep(5);
return 'An awesome string has been generated!';
}