Skip to content

Instantly share code, notes, and snippets.

View gwenzek's full-sized avatar
🛠️
make it Work, make it Fast, make it Clean

Guillaume Wenzek gwenzek

🛠️
make it Work, make it Fast, make it Clean
View GitHub Profile
@gwenzek
gwenzek / build.zig
Last active May 5, 2024 22:43
Building with Zig and system LLVM
const std = @import("std");
const Build = std.Build;
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Instead of using the classic b.addExecutable, we use a custom rule
// to compile with Zig, then optimize with LLVM.
const exe = addLLvmExecutable(b, .{
@gwenzek
gwenzek / remote_subl.md
Last active May 3, 2024 05:52
Sublime Text for remote development

This steps should help working remotely with Sublime Text. They are meant to be incremental, just setting up SFTP will go a long way.

My workflow

I have all my code on my laptop, edit locally and automatically push the files to my server. I never edit "tracked" files on the server directly. I sometimes modify untracked files on the server using rmate (see below).

@gwenzek
gwenzek / flexible_json_decoder.py
Created April 1, 2019 16:18
Flexible Json decoder
"""Implementation of a flexible JSON decoder
import json
from json_decoder import FlexibleJSONDecoder
j = json.loads(raw, cls=FlexibleJSONDecoder)
"""
import json
import re
@gwenzek
gwenzek / insert_doc.py
Created August 4, 2016 20:46
SublimeText plugin for inserting Doxygen style comment in code
import sublime
import sublime_plugin
# inspired from https://github.com/Rapptz/DoxyDoc/blob/master/doxydoc.py
# with scopes instead of regex
CLASS_SCOPE_ACTIVATOR = ['meta.class.identifier']
CLASS_NAME_SCOPE = 'entity.name.class'
FUN_SCOPE_ACTIVATOR = ['meta.method.identifier']
import sublime
import sublime_plugin
class FindInScope(sublime_plugin.TextCommand):
def run(self, edit, pattern='', scope='-comment'):
view = self.view
sel = view.sel()
if len(sel) > 0 and pattern == '':
@gwenzek
gwenzek / csharp.sublime-syntax
Last active August 29, 2015 14:27
.sublime-syntax for C#
%YAML 1.2
---
name: C sharp C#
file_extensions: [.cs]
scope: source.cs
variables:
bin_op: '(?:\+|-|\*|/|%|\|\||&&|\||&|\^|<<|>>|<=|<|>=|>|\?\?)'
@gwenzek
gwenzek / animal.scala
Last active August 29, 2015 14:07
playing with implicit in scala
import evidence._
object animal {
trait Animal
trait Car
trait Cow extends Animal
type MooMoo = Cow
@gwenzek
gwenzek / ProducterConsumer.scala
Last active August 29, 2015 14:05
Producter and consumer in scala
import java.util.concurrent.ArrayBlockingQueue
/**
* in answer to: http://stackoverflow.com/questions/25344130/modelling-producer-consumer-semantics-with-typeclasses/25448892#25448892
* adapted from: http://matt.might.net/articles/pipelined-nonblocking-extensible-web-server-with-coroutines/
*/
trait Coroutine extends Runnable {
def start() {
val myThread = new Thread(this)
@gwenzek
gwenzek / ArgsOps.scala
Last active July 3, 2021 21:52
Scala parser for programm args
import scala.language.implicitConversions
/**
* @author gwenzek
*
*/
class ArgsOps(ops: Map[String, OptionalParam], val args: Array[String]){
def apply(op: String) = ops(op)
}