Skip to content

Instantly share code, notes, and snippets.

<?php
include "config.php";
global $dbh;
function do_query($query, $params=array()) {
global $dbh;
try {
$stmt = $dbh->prepare($query);
if (empty($params)) {

Presentation build system

Description

This is what I use to build my slides. I have the following goals:

@krokodilerian
krokodilerian / gist:3b37b81a8b21b766f8ad
Last active August 29, 2015 14:19
read crap from port
#include <stdio.h>
#include <stdlib.h>
#include <sys/io.h>
int main() {
unsigned int data;
data = inl(0x66c);
prinf ("%X\n", data);
return 0;
@krokodilerian
krokodilerian / get-port-status-snmp.sh
Created June 17, 2015 14:48
check snmp ports status
#!/bin/bash
if [ -z "$2" ]; then
echo Usage: "$0" hostname community
exit 4
fi
srv="$1"
com="$2"
snmp="snmpget -v 2c -c $2 -Cf -Ov -OQ $srv"
@krokodilerian
krokodilerian / do_checks.sh
Created August 5, 2015 10:04
do_checks.sh
#!/bin/bash
# Do local checks and send output to nagios
# by maniax
nagioshost=nagios.ludost.net
hst=`hostname`
cd `dirname $0` || exit 3
@krokodilerian
krokodilerian / scroll.php
Last active September 6, 2015 18:36
simple json scroller
<?php
$betweenletters=0;
$firstline=2000000;
$betweentalks=10000000;
function spline($line) {
global $betweenletters;
for ($i=0;$i<strlen($line);$i++) {
echo $line[$i];
#!/usr/bin/python
from __future__ import absolute_import, division, print_function, unicode_literals
""" Simple textruring of Sphere objects against a plane. The atmosphere has
blend set to True and so has to be drawn after object behind it to allow them
to show through. Normal map used for moon is just a 'normal' pictures so normals
are calculated strangely and create odd shadows.
Uses the import pi3d method to load *everything*
"""
from math import sin, cos
import demo
@krokodilerian
krokodilerian / workshop.md
Last active February 26, 2016 12:24
bgp workhshop

BGP workshop

Целта на workshop-а е хората да се научат да подкарват BGP и основни неща около него. Ще научим:

  • Как се пуска bgp с upstream, peer и exchange;
  • Как и защо се филтрират пътища
  • Как правилно да си анонсираме собствените мрежи към света.

Setup

@krokodilerian
krokodilerian / lamps.php
Created January 27, 2016 21:42
lamps.php
<?php
$offafter=15*60;
$loop=60;
$lightstatus = array();
$lightstatus[0]='off';
$lightstatus[1]='on';
volatile int die=0;
void thread_func() {
while (42) {
do_something();
do_anotherthing();
if (die) {
close(fd);
return;