Skip to content

Instantly share code, notes, and snippets.

View kkirsche's full-sized avatar

Kevin Kirsche kkirsche

View GitHub Profile
@kkirsche
kkirsche / AngularJS-List-Animation.markdown
Last active August 29, 2015 14:08
AngularJS List Animation Pen by Kevin Kirsche.

AngularJS List Animation

We are using ngAnimate / $animate service for AngularJS to slide a list item out from the above list item similar to list animations on the iPhone.

This AngularJS List Animation application is a Pen by R4z3r on CodePen.

License.

@kkirsche
kkirsche / _.md
Last active August 29, 2015 14:11
Reddit Bar Chart
@kkirsche
kkirsche / tmux.md
Last active August 29, 2015 14:11 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@kkirsche
kkirsche / shell.md
Last active August 29, 2015 14:11
Shell Shortcuts

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U (bash) — Clear the characters on the line before the current cursor position
  • CTRL + U (zsh) — If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor
@kkirsche
kkirsche / countries.rb
Last active August 29, 2015 14:12
International Country Codes / State Abbreviations
# Use strings for un_num to avoid octal number interpretation
@countries = {
afghanistan: {
name: 'Afghanistan',
iso: 'AF',
un_a3: 'AFG',
un_num: '004',
dial: 93
},
albania: {
@kkirsche
kkirsche / authorize_me.sh
Last active August 29, 2015 14:19
Set local machine's public key as authorized on remote machine over SSH
cat ~/.ssh/id_rsa.pub | ssh root@10.211.55.9 'mkdir -p ~/.ssh/; touch ~/.ssh/authorized_keys; cat >> .ssh/authorized_keys'
@kkirsche
kkirsche / i_need_a_secure_string.py
Last active August 29, 2015 14:19
Secure String Generator
from base64 import b64encode;
from os import urandom;
from sys import argv;
def random_bytes(bytes):
random_bytes = urandom(bytes);
return b64encode(random_bytes).decode('utf-8');
if len(argv) > 1:
byte_value = int(argv[1])
@kkirsche
kkirsche / DSL Examples
Last active August 29, 2015 14:19 — forked from egaumer/DSL Examples
# simple match all query with term facet
ejs.Request()
.indices("myindex")
.types("mytype")
.query(ejs.MatchAllQuery())
.facet(
ejs.TermsFacet('url')
.field('url')
.size(20))
@kkirsche
kkirsche / validate_ip.py
Last active August 29, 2015 14:21
For Validating IP Addresses in Python
def is_valid_ipv4(ip):
"""Validates IPv4 addresses.
"""
pattern = re.compile(r"""
^
(?:
# Dotted variants:
(?:
# Decimal 1-255 (no leading 0's)
[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}
@kkirsche
kkirsche / syn-poc.rb
Last active August 29, 2015 14:23 — forked from KINGSABRI/syn-poc.rb
#!/usr/bin/env ruby
# Full Contol on Ethnet, IP & TCP headers. Play with it ;)
# to test it: nc -lvp 4444
# as root: tcpdump -nvvvv 'tcp port 4444' -i wlan0 # change wlan0 to your interface
# or use packetfu to monitor as tcpdump
## cap = PacketFu::Capture.new(:iface => 'wlan0' , :promisc=> true)
## cap.show_live(:filter => 'tcp and port 4444')
# libpcap should be installed
# gem install pcaprub packetfu