Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Ilgrim / vimdiff.md
Created August 23, 2016 10:07 — forked from mattratleph/vimdiff.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@Ilgrim
Ilgrim / app.py
Created January 13, 2017 15:59 — forked from vgoklani/app.py
Using Flask to output Python data to High Charts
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
@Ilgrim
Ilgrim / github-oauth2-client.php
Created January 13, 2017 23:32
Simple PHP example of using Github's OAuth 2 API
<?php
define('OAUTH2_CLIENT_ID', '');
define('OAUTH2_CLIENT_SECRET', '');
$authorizeURL = 'https://github.com/login/oauth/authorize';
$tokenURL = 'https://github.com/login/oauth/access_token';
$apiURLBase = 'https://api.github.com/';
session_start();
@Ilgrim
Ilgrim / README.rst
Created January 14, 2017 22:22 — forked from rduplain/README.rst
Demonstrate use of fixture with Flask-SQLAlchemy and Flask-Testing.

Demonstrate use of fixture with Flask-SQLAlchemy and Flask-Testing. February 13, 2011 Ron DuPlain <ron.duplain@gmail.com>

Post any feedback to: flask@librelist.org

Get this gist:

git clone git://gist.github.com/824472.git Flask-SQLAlchemy-Fixture
cd Flask-SQLAlchemy-Fixture
@Ilgrim
Ilgrim / ftpserver.py
Created March 21, 2017 09:38 — forked from scturtle/ftpserver.py
simple ftp server by python
#!/usr/bin/env python2
# coding: utf-8
import os,socket,threading,time
#import traceback
allow_delete = False
local_ip = socket.gethostbyname(socket.gethostname())
local_port = 8888
currdir=os.path.abspath('.')
class BTreeNode(object):
"""A B-Tree Node.
attributes
=====================
leaf : boolean, determines whether this node is a leaf.
keys : list, a list of keys internal to this node
c : list, a list of children of this node
"""
def __init__(self, leaf=False):
@Ilgrim
Ilgrim / asyncio_ssl_example.py
Created January 9, 2017 16:02 — forked from messa/asyncio_ssl_example.py
Python asyncio + SSL TCP client/server example
#!/usr/bin/env python3
import asyncio
import multiprocessing
import os
import ssl
from time import sleep
port = 9000
@Ilgrim
Ilgrim / chat.py
Created July 26, 2017 10:54 — forked from gregvish/chat.py
Python 3.4 asyncio chat server example
from socket import socket, SO_REUSEADDR, SOL_SOCKET
from asyncio import Task, coroutine, get_event_loop
class Peer(object):
def __init__(self, server, sock, name):
self.loop = server.loop
self.name = name
self._sock = sock
self._server = server
Task(self._peer_handler())
@Ilgrim
Ilgrim / gist:9af9f4a4b24075e3fa3203f4578cca7c
Created July 31, 2017 06:13 — forked from berlinbrown/gist:4176103
Simple Java 2D Example, Double Buffering
/**
* Copyright (c) 2006-2010 Berlin Brown and botnode.com All Rights Reserved
*
* http://www.opensource.org/licenses/bsd-license.php
* All rights reserved.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@Ilgrim
Ilgrim / generate_data.sh
Created August 22, 2017 15:57
A simple SHA256 hashing example, written in Python using hashlib
#!/bin/bash
# Generates ten data files, each 300 MB in size and filled with random data.
[[ ! -d "data/" ]] && mkdir "data/"
for i in {1..10}; do
dd if="/dev/random" of="data/file${i}" bs=1m count=300
done