Skip to content

Instantly share code, notes, and snippets.

View kornelski's full-sized avatar
💤
Please be patient, it will take a while

Kornel kornelski

💤
Please be patient, it will take a while
View GitHub Profile
@kornelski
kornelski / Dockerfile
Last active February 10, 2023 14:33
Minimal docker image for building x86-64 .deb packages from Rust/Cargo on Apple Silicon (M1/M2) Mac host
FROM rust:1-slim-bullseye
RUN rustup target add x86_64-unknown-linux-gnu
RUN dpkg --add-architecture amd64
RUN apt-get update; apt-get install build-essential crossbuild-essential-amd64 pkg-config libssl-dev:amd64 libsqlite3-dev:amd64 -y
RUN cargo install cargo-deb
ENV HOST_CC=gcc
ENV CC_x86_64_unknown_linux_gnu=/usr/bin/x86_64-linux-gnu-gcc
# now copy your sources and run `cargo deb --target x86_64-unknown-linux-gnu`

Keybase proof

I hereby claim:

  • I am kornelski on github.
  • I am kornel (https://keybase.io/kornel) on keybase.
  • I have a public key whose fingerprint is BE09 ABE0 B5C6 7596 9003 C20A AEBA DBD4 3DE5 5B2E

To claim this, I am signing this object:

static unsigned update_adler32(unsigned adler, const unsigned char* data, unsigned len) {
unsigned s1 = adler & 0xffff;
unsigned s2 = (adler >> 16) & 0xffff;
while(len > 0) {
/*at least 5550 sums can be done before the sums overflow, saving a lot of module divisions*/
unsigned amount = len > 5550 ? 5550 : len;
len -= amount;
while(amount > 0) {
s1 += (*data++);
Language Adding files from filesystem to the build How? Unfinished files break the program?
Rust Explicit mod declaration No
CommonJS Explicit require import No
ES6 Explicit import import No
Python Explicit import import No
Lua (new) Explicit require import No
PHP Explicit require or use via autoload import or any use No
Perl Explicit use import No
running 71 tests
test header_blocks_h ... ok
test header_anon_enum_whitelist_h ... ok
test header_bitfield_method_mangling_h ... ok
test header_complex_global_h ... ok
test header_const_resolved_ty_h ... ok
test header_complex_h ... FAILED
test header_constant_evaluate_h ... FAILED
test header_constify_all_enums_h ... FAILED
gulp.task('css-browsersync', function() {
return gulp.src(["*.scss"])
.pipe(sass().on('error', function(err) {
console.error(err.message);
browserSync.notify(err.message, 3000); // Display error in the browser
this.emit('end'); // Prevent gulp from catching the error and exiting the watch process
}))
.pipe(gulp.dest("public/"))
.pipe(browserSync.stream());
});
@kornelski
kornelski / sparklecheck.sh
Created February 14, 2016 00:44
Find apps with unsafe Sparkle versions
#!/bin/bash
set -o pipefail
IFS=$'\n'
REPORT=''
checkapp() {
local APPPATH=$1
local PLIST="$APPPATH/Contents/Info.plist"
local SPARKLEPLIST="$APPPATH/Contents/Frameworks/Sparkle.framework/Resources/Info.plist"
local SPARKLEBIN="$APPPATH/Contents/Frameworks/Sparkle.framework/Sparkle"
#![feature(path, io, env, core)]
extern crate "pkg-config" as pkg_config;
use std::env;
use std::old_io::{self, fs, Command};
use std::old_io::process::InheritFd;
fn main() {
let (build, mut cargo) = crater::current();
@kornelski
kornelski / search.php
Last active August 29, 2015 14:00 — forked from antirez/search.php
Codegolfed
<?
require("redis.php");
$term = $_GET['term'];
$r = new Redis("127.0.0.1","6379");
$r->connect();
$items = $r->zrangebylex("kernel", "[$term", "[$term\xff", ["LIMIT","0","10"]);
$t = [];

Which one do you prefer?

We are trying to create a new manifest format for the Web. It will allow you to define metadata for a web application in one place.

Right now, we are trying to decide how to "inline" the manifest into HTML. Need your feedback.

A - using a meta element and content attribute

<!doctype html>