Skip to content

Instantly share code, notes, and snippets.

Ilgrim Ilgrim

Block or report user

Report or block Ilgrim

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
@Ilgrim
Ilgrim / vimdiff.md
Created Aug 23, 2016 — forked from mattratleph/vimdiff.md
vimdiff cheat sheet
View vimdiff.md

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 Jan 13, 2017 — forked from vgoklani/app.py
Using Flask to output Python data to High Charts
View app.py
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 Jan 13, 2017 — forked from aaronpk/github-oauth2-client.php
Simple PHP example of using Github's OAuth 2 API
View github-oauth2-client.php
<?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 Jan 14, 2017 — forked from rduplain/README.rst
Demonstrate use of fixture with Flask-SQLAlchemy and Flask-Testing.
View README.rst

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 Mar 21, 2017 — forked from scturtle/ftpserver.py
simple ftp server by python
View ftpserver.py
#!/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('.')
View gist:65d5bd5a61edad568173b76967a32ecf
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 Jan 9, 2017 — forked from messa/asyncio_ssl_example.py
Python asyncio + SSL TCP client/server example
View asyncio_ssl_example.py
#!/usr/bin/env python3
import asyncio
import multiprocessing
import os
import ssl
from time import sleep
port = 9000
@Ilgrim
Ilgrim / chat.py
Created Jul 26, 2017 — forked from gregvish/chat.py
Python 3.4 asyncio chat server example
View chat.py
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 Jul 31, 2017 — forked from berlinbrown/gist:4176103
Simple Java 2D Example, Double Buffering
View gist:9af9f4a4b24075e3fa3203f4578cca7c
/**
* 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 Aug 22, 2017 — forked from rji/generate_data.sh
A simple SHA256 hashing example, written in Python using hashlib
View generate_data.sh
#!/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
You can’t perform that action at this time.