Skip to content

Instantly share code, notes, and snippets.

View matzipan's full-sized avatar

Andrei matzipan

  • Berlin
View GitHub Profile
@jphickey
jphickey / sch_custom.c
Created February 25, 2020 16:01
Simplified "custom" logic for CFS SCH applcation
/*
** $Id: sch_custom.c 1.3 2015/03/01 14:01:44EST sstrege Exp $
**
** Copyright 2007-2014 United States Government as represented by the
** Administrator of the National Aeronautics and Space Administration.
** All Other Rights Reserved.
**
** This software was created at NASA's Goddard Space Flight Center.
** This software is governed by the NASA Open Source Agreement and may be
** used, distributed and modified only pursuant to the terms of that
@jspahrsummers
jspahrsummers / AsynchronousGenerators.md
Last active February 16, 2024 18:55
Python asynchronous generator semantics and types

How to use asynchronous generators

The documentation 6.2.9.4. "Asynchronous generator-iterator methods" is phrased really ambiguously. To make matters worse, typing.AsyncGenerator is not specified fully correctly.

Here, I attempt to more clearly capture the actual interface contract, based on what I've read and observed. See also PEP 492 -- Coroutines with async and await syntax and PEP 525 -- Asynchronous Generators.

This might be useful to implement lower-level behaviors than you can with async for, like sending values into the generator function.

TSend = TypeVar('TSend', contravariant=True)
@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@aras-p
aras-p / preprocessor_fun.h
Last active April 12, 2024 17:24
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,

Recently, we've been working on extracting Ember conventions from applications we're working on into the framework. Our goal is to make it clearer how the parts of an Ember application work together, and how to organize and bootstrap your objects.

Routing

Routing is an important part of web applications. It allows your users to share the URL they see in their browser, and have the same things appear when their friends click on the link.

The Ember.js ecosystem has several great solutions for routing. But, since it is such an important part of most web applications, we've decided to build it right into the framework.

If you have already modeled your application state using Ember.StateManager, there are a few changes you'll need to make to enable routing. Once you've made those changes, you'll notice the browser's address bar spring to life as you start using your app—just by moving between states, Ember.js will update the URL automatically.

@troy
troy / send_remote_syslog.php
Last active April 6, 2023 18:19
Send UDP remote syslog message from PHP (RFC 3164)
# replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT
# see http://help.papertrailapp.com/ for additional PHP syslog options
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT);
}
socket_close($sock);
@luetkemj
luetkemj / wp-query-ref.php
Last active February 6, 2024 14:25
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@badsyntax
badsyntax / build.sh
Created January 11, 2011 20:56
An example PHP & BASH Post-Receive github web hook to package projects
#! /usr/bin/env bash
#clone the repo
git clone -q "${1}" "clones/${2}"
cd "clones/${2}"
#update the submodules (how do we handle errors here?)
git submodule --quiet update --init --recursive
@reu
reu / deploy.rb
Created November 6, 2010 12:41
Capistrano deploy recipe for database configuration
# Bundler Integration
require "bundler/capistrano"
# Application Settings
set :application, "yourapplicationname"
set :user, "serveruser"
set :deploy_to, "/home/#{user}/rails-applications/#{application}"
set :rails_env, "production"
set :use_sudo, false
set :keep_releases, 3