Skip to content

Instantly share code, notes, and snippets.

View yannick's full-sized avatar
🏗️

Yannick Koechlin yannick

🏗️
View GitHub Profile
/*
* bpt.c
*/
#define Version "1.13"
/*
*
* bpt: B+ Tree Implementation
* Copyright (C) 2010 Amittai Aviram http://www.amittai.com
*
* This program is free software: you can redistribute it and/or modify
require 'cherti/all'
include Cherti
def create_ad_url_override(user_id, ad_url, lang='ad')
device_types = ['mobile', 'tablet', 'pc']
device_types.each do |dt|
AdUrl.find_or_create(:auth_provider => User[user_id].auth_provider, :device_type => dt, :lang => lang, :url => ad_url)
end
end
import std.stdio;
import std.file, std.algorithm, std.datetime, std.range;
void main() {
DirEntry[] allFiles;
foreach(DirEntry entry; dirEntries("/home/yannick",
SpanMode.depth))
allFiles ~= entry;
auto sorted = sort!((a, b) => a.size > b.size)(allFiles);
import std.stdio;
import std.file, std.algorithm, std.datetime, std.range;
void main() {
DirEntry[] allFiles;
foreach(DirEntry entry; dirEntries("/home/yannick", SpanMode.depth)){
allFiles ~= entry;
}
auto sorted = sort!((a, b) => a.size > b.size)(allFiles);
import leveldb;
import std.stdio;
import leveldb.writebatch;
import std.bitmanip;
import std.datetime;
import std.random;
import std.file;
import std.string;
import std.conv;
import core.memory;
import std.stdio;
import leveldb;
import vibe.core.concurrency;
import vibe.core.core;
import std.datetime;
shared static int counter;
shared static Task dbTask;
struct Query{ Task sender; string msg;}
@yannick
yannick / gist:8ab93ad5b84e7561404a
Created February 15, 2015 18:13
vibed.d requestHTTP
struct ApiResponse{ int code; string bdy;};
static string UA = "xxx";
ApiResponse get_article(string url_part1, string url_part2) {
ApiResponse ret;
auto url = "http://" ~ url_part1 ~ "/blabla/" ~ url_part2;
@yannick
yannick / gist:6541568b91de13c24840
Created February 16, 2015 12:29
/usr/local/etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /usr/local/etc/my.cnf.d
package main
import (
"bufio"
"bytes"
"compress/gzip"
"fmt"
"github.com/mitchellh/goamz/aws"
"github.com/mitchellh/goamz/s3"
"io"
#!/usr/bin/env bash
# ~/.osx — https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &