Skip to content

Instantly share code, notes, and snippets.

apokalyptik

Block or report user

Report or block apokalyptik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@apokalyptik
apokalyptik / debian-jessie-kubernetes-1.3-manual-install-guide.md
Last active Aug 15, 2019
Set up Kubernetes on 3 Debian Jessie virtual machines -- No magic
View debian-jessie-kubernetes-1.3-manual-install-guide.md

The Goal

Set up Kubernetes on 3 Debian Jessie virtual machines: One master. Two nodes. Additionally do this without any "magic" so that what is required to be running to make everything work is plain and obvious.

We will be using flannel for the inter-machine networking layer. Mainly because it is useful and it seems to be pretty popular.

The Setup

@apokalyptik
apokalyptik / encrypt.go
Created Sep 1, 2014
Go RSA public key encryption example. Compatible with http://us3.php.net/manual/en/function.openssl-private-decrypt.php for decryption
View encrypt.go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"log"
@apokalyptik
apokalyptik / .vimrc
Last active Oct 5, 2017
My .vimrc file
View .vimrc
" Instructions:
" 1. Download this .vimrc file:
" curl https://gist.githubusercontent.com/apokalyptik/fdf050e2dd004b756d2e1a0b6f2d399a/raw/.vimrc > .vimrc
" 2. Install vundle:
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" 3. Run vim
" 4. Install Plugins:
" :PluginInstall
" 5. Exit vim
View keep.go
package main
import (
"bufio"
"flag"
"fmt"
"io"
"log"
"os"
)
View extract-php-func-calls
#!/usr/bin/env php
<?php
define( 'DEBUG_RECURSION', false );
if ( $_SERVER['argc'] > 1 ) {
if ( substr( $_SERVER['argv'][1], 0, 1 ) !== "/" ) {
define( 'FUNCTION_MATCH', "/" . preg_quote( $_SERVER['argv'][1] ) . "/" );
} else {
define( 'FUNCTION_MATCH', $_SERVER['argv'][1] );
@apokalyptik
apokalyptik / 1 - setup the virtual machines
Last active Jan 26, 2017
Installing jobs system from scratch by itself on Debian 8.
View 1 - setup the virtual machines
2x Debian 8
- 2GB Ram
- 20GB disk
- selected: SSH server, and Standard Utilities
jobs1.test.local
eth0 - bridged, configured 10.0.1.12 (change depending on your network)
eth1 - lan, configured to 192.168.0.1 (change to suite your liking)
jobs2.test.local
View uni.py
#!/usr/bin/python
import re
import unicodedata
lm = re.compile("^[0-9a-fA-F]")
s = u""
# http://www.unicode.org/Public/5.2.0/ucd/NamesList.txt
View uni.py
#!/usr/bin/python
import re
import unicodedata
import codecs
import urllib2
if 2 == len( u'\U0001f4a9' ):
length_ucs2 = len
else:
@apokalyptik
apokalyptik / gist:5952215
Created Jul 8, 2013
Super simple and informative exmple of using CGO
View gist:5952215
package main
// #include <ctype.h>
import "C"
import "log"
func main() {
for i := 32; i<126; i=i+1 {
log.Printf( "'%s' (%3d) isalpha: \t%d", string(byte(i)), i, C.isalpha(C.int(i)) )
}
@apokalyptik
apokalyptik / gist:5946350
Created Jul 8, 2013
Email me when it's more than 30% likely to rain soon... Pop it into cron once daily and forget. A simple and practical example of working with NOAA/weather.com DWML feeds in PHP
View gist:5946350
<?php
$email = "me@example.com";
// To find your weather feed....
// * Go here: http://forecast.weather.gov/MapClick.php?lat=37.7749295&lon=-122.41941550000001#.UdpHAj7714E
// * Search for your location (upper left side of the page as of 7/7/2013)
// * Click the orange "XML" button/link (on the right hand side, beneath the first map as of the same date)
$feed = 'http://forecast.weather.gov/MapClick.php?lat=39.01000&lon=-96.28&unit=0&lg=english&FcstType=dwml';
You can’t perform that action at this time.