Skip to content

Instantly share code, notes, and snippets.

Avatar
🎸

Jason Ashby snobear

🎸
View GitHub Profile
View Podfile
# When using RN in combination with Cocoapods, a lot of
# things are broken. These are the fixes we had to append
# to our Podfile when upgrading to ReactNative@0.55.3.
#
# WARNING: Check those line numbers when you're on a different version!
def change_lines_in_file(file_path, &change)
print "Fixing #{file_path}...\n"
contents = []
@h0tw1r3
h0tw1r3 / syslog-ng.conf
Created Oct 22, 2017
Syslog-ng 3.6.4 configuration
View syslog-ng.conf
@version:3.6
@include "scl.conf"
options {
flush-timeout(2000);
chain-hostnames(no);
use-dns(yes);
use-fqdn(no);
create-dirs(yes);
keep-hostname(yes);
@dnmellen
dnmellen / worker_function.py
Created Jan 31, 2017
AWS Lambda function that performs an ssh command through a bastion server to another server. The function will be triggered by a Cloudwatch Alarm
View worker_function.py
import json
import boto3
import paramiko
def worker_handler(event, context):
ALLOWED_HOSTS = [
'host1',
'host2,
@esrever10
esrever10 / gs.sh
Last active May 4, 2021
gstreamer send and receive h264 rtp stream
View gs.sh
# linux send h264 rtp stream:
gst-launch-1.0 -v ximagesrc ! video/x-raw,framerate=20/1 ! videoscale ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host=127.0.0.1 port=5000
# Macos send h264 rtp stream:
gst-launch-1.0 -v avfvideosrc capture-screen=true ! video/x-raw,framerate=20/1 ! videoscale ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host=127.0.0.1 port=5000
# receive h264 rtp stream:
gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
@lfepp
lfepp / recurring_maintenance_windows.py
Last active Aug 21, 2020
Script to create a number of recurring maintenance windows in PagerDuty
View recurring_maintenance_windows.py
#!/usr/bin/env python
#
# Copyright (c) 2016, PagerDuty, Inc. <info@pagerduty.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active May 10, 2021
Add Git Branch Name to Terminal Prompt (Linux/Mac)
View terminal-git-branch-name.md

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@snobear
snobear / cancel-pulp-tasks.sh
Last active Jun 21, 2019
script to cancel all pulp tasks
View cancel-pulp-tasks.sh
#!/bin/bash
#
# Cancel all pulp tasks that are just in a specifiedstate
tmpfile=/tmp/tasks
read -p "Enter task state to kill, e.g. Waiting: " ans
echo ""
if [ "${#ans}" -gt 0 ]
then
@drscream
drscream / check_pypi_mirror.sh
Last active Nov 10, 2015
Simple script to download the `last-modified` file from PyPI mirror and check if it's up-to-date.
View check_pypi_mirror.sh
#!/bin/bash
# Thomas Merkel <tm@core.io>
# Check PyPI mirror with nagios
PROGPATH=$(echo ${0} | sed -e 's,[\\/][^\\/][^\\/]*$,,')
REVISION="1.1"
source ${PROGPATH}/utils.sh
# Function to print help
View stream_twitter_tutorial.md

Build a scalable Twitter clone with Django and GetStream.io

In this tutorial we are going to build a Twitter clone using Django and GetStream.io, a hosted API for newsfeed development.

We will show you how easy is to power your newsfeeds with GetStream.io. For brevity we leave out some basic Django-specific code and recommend you refer you to the Github project for the complete runnable source code. At the end of this tutorial we will have a Django app with a profile feed, a timeline feed, support for following users, hashtags and mentions.

I assume that you are familiar with Django. If you're new to Django the [official tutorial] (https://docs.djangoproject.com/en/2.0/intro/) explains it very well.

@simlegate
simlegate / custom-error-page
Created Oct 31, 2014
Nginx return custom json
View custom-error-page
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {