Skip to content

Instantly share code, notes, and snippets.

(define (parse-url url)
(define (parse-query url)
(let ( (p (str-index-of url "?")) )
(if (= p -1)
(parse-scheme url)
(cons (cons 'query (str-sub url p))
(parse-scheme (str-sub url 0 p))))))
(define (parse-scheme url)
(let ( (p (str-index-of url "://")) )
#!/usr/bin/env python3
import re
start = """
8........
..36.....
.7..9.2..
.5...7...
....457..
// http://bartoszmilewski.com/2014/04/21/getting-lazy-with-c/ except that in C#. Still a bit fugly.
Enumerable.Range(1, Int32.MaxValue)
.SelectMany(z => Enumerable.Range(1, z - 1)
.SelectMany(x => Enumerable.Range(x, z - x)
.Where(y => x*x + y*y == z*z)
.Select(y => Tuple.Create(x, y, z))))
.Take(10)
@mvirkkunen
mvirkkunen / gist:11371443
Last active August 29, 2015 14:00
Useless auto-generated documentation comments...
/// <summary>
/// Handles the Click event of the Foo control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Foo_Click(object sender, EventArgs e)
@mvirkkunen
mvirkkunen / gist:3104c6253096a869f15c
Created May 5, 2014 16:28
LINE公式アカの「リッチメッセージ」の仕組み?
struct {
1: field = "u4b49463b1f3a980ec6fa796249ad0206"
4: field = "1170947380609"
5: field = i64 1399082996227
6: field = i64 0
10: field = "「LINE レンジャー」1,000万ダウンロード&TVCMスタート記念★2大プレゼント実施中!(このメッセージはスマートフォンでご確認ください)
全40種類!無料特製スタンプのGETはこちら
http://bit.ly/1n4uP3Y
ログインして限定レンジャー「レアレッドブラウン」をGET!
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Text;
using Thrift.Transport;
namespace LineNet.Implementation
{
void Main()
{
new Herp.Derp.Herp.Derp.Herp.Derp.Herp.Derp.Herp.Derp().Durr();
}
// Define other methods and classes here
public class Herp
{
public class Derp : Herp
Sent on every page load while https://chrome.google.com/webstore/detail/awesome-screenshot-captur/alelhddbbhepgpmgidjdcjakblofbmce?hl=en is installed (this is me visiting www.example.com)
POST /service2 HTTP/1.1
Host: t.crdui.com
Connection: keep-alive
Content-Length: 418
Accept: application/json, text/javascript, */*; q=0.01
Origin: chrome-extension://alelhddbbhepgpmgidjdcjakblofbmce
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
@mvirkkunen
mvirkkunen / lists.cpp
Created June 14, 2014 13:48
Damn it C++
recent_msgs.erase(
std::remove_if(
recent_msgs.begin(),
recent_msgs.end(),
[&queue](line::Message &rm) {
auto r = find_if(
queue->begin(),
queue->end(),
[&rm](line::Message &qm) { return qm.id == rm.id; });
clc
lda ADDRLO
adc #16
sta ADDRLO
lda ADDRHI
adc #0
sta ADDRHI