Skip to content

Instantly share code, notes, and snippets.

View LyndonArmitage's full-sized avatar

Lyndon Armitage LyndonArmitage

View GitHub Profile
@duboisf
duboisf / zscaler_ufw.txt
Last active January 18, 2024 19:05
ufw rules to get zscaler working on linux
sudo ufw allow in on zcctun0 proto any from 10.0.0.0/8 to 100.64.0.1 port 9000
sudo ufw allow in on zcctun0 proto any from 100.64.0.0/16 to 100.64.0.1 port 9000
sudo ufw allow in on zcctun0 proto any from 100.64.0.0/16 to 100.64.0.1 port 9010
sudo ufw allow in on zcctun0 proto udp from 100.64.0.0/16 to 100.64.0.1
@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 05:24
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@fjavieralba
fjavieralba / KafkaLocal.java
Last active March 23, 2021 09:57
Embedding Kafka+Zookeeper for testing purposes. Tested with Apache Kafka 0.8
import java.io.IOException;
import java.util.Properties;
import kafka.server.KafkaConfig;
import kafka.server.KafkaServerStartable;
public class KafkaLocal {
public KafkaServerStartable kafka;
public ZooKeeperLocal zookeeper;
@malfortuna
malfortuna / gist:5521046
Created May 5, 2013 14:59
A bot used to tweet one Ludum Dare game per hour, over on Twitter at @LudumLegacy
import json, pprint, subprocess, urllib, urllib2, re, sys
import json as simplejson
import urllib2
import xml.sax.saxutils
from getpass import getpass
from urllib import urlencode
import time, getopt
#sys.path = [ #Load of stupid path amendments for Dreamhost ]
@subnetmarco
subnetmarco / CorsRequest.js
Last active July 10, 2018 09:03
Sample code for executing an AJAX request using jQuery.
$.ajax({
url: 'MASHAPE-URL', // The URL to the API. You can get this by clicking on "Show CURL example" from an API profile
type: 'POST', // The HTTP Method
data: {}, // Additional parameters here
dataType: 'json',
success: function(data) { alert(JSON.stringify(data)); },
error: function(err) { alert(err); },
beforeSend: function(xhr) {
xhr.setRequestHeader("X-Mashape-Authorization", "YOUR-MASHAPE-KEY"); // Enter here your Mashape key
}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@banksean
banksean / mersenne-twister.js
Created February 10, 2010 16:24
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();