Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Kirsche kkirsche

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

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 Aug 29, 2015
Reddit Bar Chart
View _.md
View 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 Aug 29, 2015
Shell Shortcuts
View shell.md

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 Aug 29, 2015
International Country Codes / State Abbreviations
View countries.rb
# 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 Aug 29, 2015
Set local machine's public key as authorized on remote machine over SSH
View authorize_me.sh
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 Aug 29, 2015
Secure String Generator
View i_need_a_secure_string.py
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])
View 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 Aug 29, 2015
For Validating IP Addresses in Python
View validate_ip.py
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}
View 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