Skip to content

Instantly share code, notes, and snippets.

View iho's full-sized avatar
🏠
Working from home

iho iho

🏠
Working from home
  • Kyiv, Ukraine
  • 13:03 (UTC +02:00)
View GitHub Profile
@iho
iho / main.go
Created December 16, 2018 10:41 — forked from mendelgusmao/main.go
.zsh_history merge+remove duplicate lines
package main
import (
"fmt"
"io/ioutil"
"os"
"regexp"
"sort"
"strconv"
"strings"
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@iho
iho / announce.php
Created October 7, 2018 14:58 — forked from nsuan/announce.php
Bitstorm Tracker
<?php
/*
* Bitstorm - A small and fast Bittorrent tracker
* Copyright 2008 Peter Caprioli
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@iho
iho / IdempotentSQLAlterTableAddColumn.sql
Created May 12, 2016 18:49 — forked from kmoormann/IdempotentSQLAlterTableAddColumn.sql
Idempotent SQL Alter Table Statements
IF NOT EXISTS
(
SELECT * FROM [information_schema].[columns]
WHERE table_name = 'Customer'
AND table_schema = 'dbo'
AND column_name = 'FavoriteColorId'
)
BEGIN
ALTER TABLE [dbo].[Customer]
ADD FavoriteColorId int
@iho
iho / Makefile
Created May 1, 2016 16:19 — forked from nzjrs/Makefile
Python ctypes example
all: test libtest.so testmodule
libtest.so: libtest.c
$(CC) -Wall -g -fPIC -shared -o $@ $? -lc
test: test_main.c libtest.o
$(CC) -o $@ $?
testmodule: testmodule.c
python setup.py build
@iho
iho / demo.py
Created May 1, 2016 15:59 — forked from bwhite/demo.py
Integrating Python + C: Ctypes and Cython
import ctypes
import time
import numpy as np
import example_cython
def mult_sum(a):
b = 0
for i in range(10000):
b += a * i
@iho
iho / gist:96c78bc30ef164ed462fca0b07e61e31
Created April 21, 2016 17:19 — forked from pelagisk/gist:2311852
Vim-cute-python adaptation for emacs?
(defun cute-python ()
(interactive)
(remove-overlays)
(let (
(strings '(
(" != " . " ≢ ")
(" in " . " ∈ ")
(" or " . " ∨ ")
(" and " . " ∧ ")
(" is not " . " ¬ ")
@iho
iho / image.js
Created December 16, 2015 23:04 — forked from Snugug/image.js
Image Renderer for Marked (https://github.com/chjj/marked/) to transform it into a media embed tool
var marked = require('marked'),
fs = require('fs'),
path = require('path'),
URI = require('URIjs'),
renderer = new marked.Renderer(),
file = fs.readFileSync('./foo.md', 'utf8');
// Set Marked's rendereer to the custom renderer
// optional `localVideoPath` option will be used to to find fallback videos for `.webm`. Defaults to ''
marked.setOptions({
@iho
iho / emoji.py
Last active September 15, 2015 14:57 — forked from nitely/emoji.py
Emojis for python-Markdown
#-*- coding: utf-8 -*-
# Tested on Markdown 2.3.1
#
# Copyright (c) 2014, Esteban Castro Borsani
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@iho
iho / blocks.py
Last active October 22, 2015 20:55 — forked from frankwiles/blocks.py
Code and Markdown blocks for Wagtail 1.0 StreamField
from django.utils.safestring import mark_safe
from markdown import markdown
from pygments import highlight
from pygments.formatters import get_formatter_by_name
from pygments.lexers import get_lexer_by_name
from wagtail.wagtailcore import blocks
class CodeBlock(blocks.StructBlock):