Skip to content

Instantly share code, notes, and snippets.

Avatar

Madis Nõmme madis

View GitHub Profile
@madis
madis / bad_input.c
Created May 20, 2012
Secure programming homework
View bad_input.c
/**
* Secure programming HW4
* Find all potential vulnerabilities in this C function get_user_input
* Compiling: $ make main
* Running: $ ./main
*/
#include <stdio.h>
#include <stdlib.h> // For malloc
#include <string.h> // For strlen
@madis
madis / lets_install.sh
Created Sep 24, 2012
Lets install stuff automatically
View lets_install.sh
#!/bin/bash
echo Doing it now!
@madis
madis / gist:3781480
Created Sep 25, 2012
Konkreetne vs Abstraktne
View gist:3781480
Konkreetne							|	Abstraktne
====================================================
roheline							- värv
Clojure								- programmeerimiskeel
minu iPhone, praegusel ajahetkel 	- lihtsalt telefon
Juku								- loll
Programmeerija firmas X				- töökoht
View check_dependencies.sh
#!/bin/bash
echo "This script checks if you have all dependencies installed"
# Check for RVM
#RESULT= `type rvm | head -1`
RESULT="rvm is a function"
echo $RESULT
if [[ $RESULT = "rvm is a function" ]]; then
echo "RVM is OK"
View vim_findings.md

Line navigation

  • k - up
  • j - down
  • h - left
  • l - right

Current line, go to:

  • 0 - start
  • ^ - firs non-blank character
@madis
madis / gist:4067411
Last active Oct 12, 2015
Sublime tips
View gist:4067411
  • crtl+cmd+g - select matching text
  • crtl+m - jump to matching bracket
  • crtl+left/right - move cursor left / right word segment
  • crtl+k+d - discard current selection and create a cursor at the next
@madis
madis / gist:4101315
Created Nov 17, 2012
TextMate findings
View gist:4101315

Create ctags file for SublimeText containing current floder + used gemsets - ctags --extra=+f --exclude=.git --exclude=log -f .tags -R . `rvm gemdir`/gems/*

@madis
madis / gist:4126822
Created Nov 21, 2012
prompt with git additions
View gist:4126822
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
DARK_GRAY="\[\033[0;90m\]"
COLOR_NONE="\[\e[0m\]"
View Useful debugging snippets
```bash
# Make a POST request with post parameter
# -i for showing headers
# -d for passing post parameters
curl -i -d "site_key=almost_random" -X POST http://localhost:3001/api/visits
# Save a cookie in a file
curl -c visits_cookie.txt -d "site_key=almost_random" -X POST http://localhost:3001/api/visits
# Make a POST request with cookie
@madis
madis / redis-server
Last active Dec 11, 2015
init.d script for starting redis server. Provides start/stop/reload/status
View redis-server
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db