To learn Zig I implemented some crypto functions in Zig. It uses unique Zig comptime features to reduce code duplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Long Tweet Remover | |
// @version 0.1 | |
// @description remove tweets with more than 280 characters | |
// @author Jelle Besseling | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# This alphabet is handpicked to be visually distinctive | |
_alphabet = ['☕️', '🐜', '✉️', '🎋', '👟', '📺', '😅', '✌️', '🌰', '🍇', | |
'🐶', '👢', '💉', '💈', '⚡️', '🌹', '🗽', '👌', '💔', '🎈', | |
'🥑', '⌚️', '🚿', '🐫', '🔧', '🔌', '😈', '💳', '😊', '👍', | |
'🍞', '😘', '🎯', '⛄️', '🔦', '🐳', '🍌', '‼️', '🥝', '✂️', | |
'🎄', '💥', '🍷', '🚦', '📬', '🎡', '🎆', '🔍', '🍻', '🏭', | |
'🎶', '💡', '🏄', '👂', '🗡️', '🍒', '👑', '🚃', '🙏', '❌', | |
'💾', '🙋', '👸', '🔪', '👎', '🌊', '🍕', '⚽️', '🎁', '🏈', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import Column, PickleType | |
def upsert(obj): | |
"""Inserts the `obj` or updates if it already exists | |
Postgresql is the only database that supports upserts like this, but sqlite is used locally so a "hack" is used to support | |
an alternative check and update/insert method. This cannot be used when multithreading.""" | |
# SQLalchemy model objects have the table object in __table__ | |
table = obj.__table__ | |
# Filter out private values from the object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import sys | |
from datetime import datetime | |
from b2.api import B2Api | |
def parse(inp, mformat=None, thing=None): | |
if thing is None: | |
thing = 'th' | |
if mformat is None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# MIT License | |
# | |
# Copyright (c) 2016 Jelle Besseling | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3 | |
MAINTAINER Jelle Besseling <jelle@pingiun.com> | |
COPY . /app | |
WORKDIR /app | |
RUN pip install uwsgi && pip install -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
let | |
helios-src = builtins.fetchTarball "https://github.com/pingiun/helios-server/archive/147da23bd9097c16c94a24cf4cc98bd709a35393.tar.gz"; | |
helios = import helios-src; | |
user = "helios"; | |
db-name = user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
// initialize the tape with 30,000 zeroes | |
unsigned char tape[30000] = {0}; | |
// set the pointer to point at the left-most cell of the tape | |
unsigned char* ptr = tape; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.7.0; | |
import "Owner.sol"; | |
/** | |
* Track habits with a financial stake if you fail. | |
*/ | |
contract Habits is Owner { | |
struct Habit { |
NewerOlder