Skip to content

Instantly share code, notes, and snippets.

<?php
header("Content-type: application/json");
$lang = "en";
$dir = "/var/www/html/talkdata/";
$text = $_GET['t'];
$m = urlencode($text);
$filename = $lang . "-". $m . ".mp3";
$file = $dir.$filename;
if (!file_exists($file)) {
$mp3 = file_get_contents(
<html>
<head>
<title>Talk</title>
<script src="jquery-3.3.1.min.js"></script>
</head>
<body>
Say
<form onsubmit="return say();">
<input type="text" style="font-size: 72pt; background: #eeeeee" id="t" size=30 >
</form>
@yohanes
yohanes / pidgey.py
Last active September 6, 2016 03:54
How many Pidgeys you need to reach an XP (assuming you always evolve after 12 candies and not using lucky egg)
import sys
if (len(sys.argv)<2):
print "Usage: python pidgey.py targetxp"
exit(0)
target_xp = int(sys.argv[1])
print "Target XP ", target_xp
@yohanes
yohanes / click_server.py
Created January 28, 2016 06:55
Click server
from flask import Flask, redirect, url_for
import os
app = Flask(__name__)
@app.route('/')
def index():
return """
<html><head><title>HDMI switcher</title><style>
.btn {
@yohanes
yohanes / click.py
Created January 28, 2016 06:54
Switch a button
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
PIN=18
GPIO.setup(PIN, GPIO.OUT)
GPIO.output(PIN, 1)
time.sleep(0.1)
GPIO.output(PIN, 0)
GPIO.cleanup()
@yohanes
yohanes / keybase.md
Created June 25, 2015 06:52
keybase.md

Keybase proof

I hereby claim:

  • I am yohanes on github.
  • I am yohanes (https://keybase.io/yohanes) on keybase.
  • I have a public key whose fingerprint is 1095 F8DF 6A46 17E1 693E AAE6 338A 94F8 AC75 B7E0

To claim this, I am signing this object:

% to run it: swipl -g 'conclusion' -t halt -q -s cheryl.pl
% http://www.straitstimes.com/news/singapore/education/story/primary-5-maths-question-goes-viral-stumps-adults-20150413
unique(A) :- aggregate_all(count, A, M), M==1.
birthday_list(15, may).
birthday_list(16, may).
birthday_list(19, may).
birthday_list(29, may).
@yohanes
yohanes / jail1.js
Created October 26, 2014 13:11
Secuinside 2014
function (rand) {
function stage1() {
var a = Array.apply(null,
new Array(Math.floor(Math.random() * 20) + 10)).map(function () {return Math.random() * 0x10000;});
var b = rand(a.length);
if (!Array.isArray(b)) {
print("You're a cheater!");
return false;
#include <ctype.h>
#include <string.h>
#include <stdio.h>
char secret_code[] = "B1lR]c5r]Qsqfg";
void alter_digit(char *s)
{
for (int i = 0; i < strlen(s); ++i)
{
@yohanes
yohanes / altered.c
Created October 26, 2014 12:38
Pwnium.c
#include <ctype.h>
#include <string.h>
#include <stdio.h>
char secret_code[] = "b!Lr}C%R}qSQFG";
void alter_digit(char *s)
{
for (int i = 0; i < strlen(s); ++i)
{