Skip to content

Instantly share code, notes, and snippets.

@seyisulu
seyisulu / Streams.py
Created April 23, 2022 15:09
Create Streamlines with ManimGL
from manimlib import *
class Streaming(Scene):
def construct(self):
fun = lambda x, y: np.sin(x/2) * UR + np.cos(y/2) * LEFT
sls = StreamLines(
fun,
NumberPlane(),
step_multiple=0.5,
stroke_width=2,
@seyisulu
seyisulu / nat.sh
Created April 23, 2022 08:59
Configure EC2 Instance as NAT
# Amazon Linux 2
#❯ ssh nat
#Last login: Sat Apr 23 07:24:49 2022 from xx.xxx.xxx.xxx
#
# __| __|_ )
# _| ( / Amazon Linux 2 AMI
# ___|\___|___|
#
#https://aws.amazon.com/amazon-linux-2/
#[ec2-user@ip-xxx-xx-xx-xx ~]$
@seyisulu
seyisulu / app.yaml
Last active December 15, 2021 12:26 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@seyisulu
seyisulu / lex.py
Created November 25, 2020 13:38 — forked from alexcasalboni/lex.py
Amazon Lex fulfillment function - Lambda handler (Python) + utilities
import logging
from lex_utils import elicit_slot, delegate, close, ElicitAction, DelegateAction
from utils import validate_dialog, init_or_load_session, finalize_session, actually_book_the_hotel
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
def lambda_handler(event, context):
logger.debug('event.bot.name=%s', event['bot']['name'])
logger.debug('userId=%s, intentName=%s', event['userId'], event['currentIntent']['name'])
@seyisulu
seyisulu / sns_http.php
Last active September 20, 2020 23:47
SNS HTTP Endpoint Handler in PHP with CloudWatch Logging
<?php
require 'vendor/autoload.php';
/*
{
"require": {
"guzzlehttp/guzzle": "^7.0",
"aws/aws-php-sns-message-validator": "^1.6",
"aws/aws-sdk-php": "^3.154",
"monolog/monolog": "^2.1",
"maxbanton/cwh": "^2.0"
@seyisulu
seyisulu / README.md
Created September 18, 2019 14:12 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@seyisulu
seyisulu / securing_rails_updates.md
Created July 29, 2018 09:40 — forked from peternixey/securing_rails_updates.md
How Homakov hacked GitHub and how to protect your application by Peter Nixey

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


@seyisulu
seyisulu / latency.txt
Created June 24, 2018 08:20 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@seyisulu
seyisulu / usage.html
Created June 8, 2018 07:49 — forked from RadoMark/usage.html
Watchers toggler directive
<div ng-app>
<div ng-controller="TestCtrl">
<ul ng-repeat="elements in array" watchers-toggler="toggler()">
<li ng-repeat="element in elements">{{element}}</li>
</ul>
</div>
</div>