Skip to content

Instantly share code, notes, and snippets.

View cengiz-io's full-sized avatar

Cengiz Can cengiz-io

View GitHub Profile
@cengiz-io
cengiz-io / $HOME|.config|lxc|default.conf
Last active February 16, 2018 08:08
unprivileged lxc setup
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 3e:3f:3a:3b:3c:3d
lxc.idmap = u 0 100000 65536
lxc.idmap = g 0 100000 65536
@qlyoung
qlyoung / linux-clang-format
Created July 17, 2017 18:37
Linux kernel style .clang-format
---
BasedOnStyle: LLVM
Language: Cpp
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AlwaysBreakBeforeMultilineStrings: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
;;; ripgrep.el --- from end for ripgrep
;;
;; Copyright (C) 2016 Nicholas Matsakis
;;
;; Adapted from ack-and-a-half.el, which is licensed as follows:
;;
;; Copyright (C) 2011 Jacob Helwig
;;
;; Author: Jacob Helwig <jacob+ack * technosorcery.net>
;; Version: 0.0.1
@ulanda
ulanda / RustJS.md
Last active March 5, 2024 23:31
Rust Compile with asmjs target

You will need nightly Rust

  • Install Rust, se rustup.sh curl -sSf https://static.rust-lang.org/rustup.sh | sh
  • Update installaion with: rustup self update rustup self update-data
  • Install nightly Rust: rustup toolchain install nightly
  • Default to nightly: rustup default nightly

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
match cache.entry(sql) {
Occupied(entry) => Ok(entry.get().clone()),
Vacant(entry) => {
let statement = try!(Statement::prepare(&self.raw_connection, entry.key()));
Ok(entry.insert(CachedStatement::new(statement)).clone())
}
}
@vancluever
vancluever / gnome-tracker-disable.md
Last active May 2, 2024 16:26
GNOME Tracker Disable

Disabling GNOME Tracker and Other Info

GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here: http://lduros.net/posts/tracker-sucks-thanks-tracker/

After discovering it chowing 2 cores, I decided to go about disabling it.

Directories

@coderbyheart
coderbyheart / arch-linux-intel-compute-stick.md
Created January 8, 2016 16:03
Arch Linux on Intel Compute Stick
@butaji
butaji / typeclasses.scala
Created October 20, 2015 19:29
Some playing around Scala's type classes
def foo[A](a: A)(implicit ma: HasSize[A]) = {
ma.size(a)
}
def boo[A : HasSize](a: A) = {
implicitly[HasSize[A]].size(a)
}
trait HasSize[-A] { def size(a: A): Int }
@randrews
randrews / hoc1.lua
Created May 29, 2015 23:32
Toy calculator in Lua, version 1
function eval(num1, operator, num2)
if operator == '+' then
return num1 + num2
elseif operator == '-' then
return num1 - num2
elseif operator == '*' then
return num1 * num2
elseif operator == '/' then
return num1 / num2
else