Skip to content

Instantly share code, notes, and snippets.

View ildus's full-sized avatar

Ildus Kurbangaliev ildus

View GitHub Profile
@ildus
ildus / run_tb.do
Created April 29, 2021 13:37 — forked from esynr3z/run_tb.do
Tcl script to run Modelsim simulation. Use "vsim -do run_tb.do" to start.
# Simply change the project settings in this section
# for each new project. There should be no need to
# modify the rest of the script.
set tb_name tb_top
set library_file_list [list \
work [list \
../../src/rtl/top.v \
../../src/tb/$tb_name.v] \
@ildus
ildus / vpnsetup.sh
Last active August 29, 2015 14:25 — forked from hwdsl2/.MOVED.md
IPsec L2TP VPN Auto Install Script for Ubuntu 14.04 & 12.04 and Debian 8 & 7
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN server
# on a Ubuntu or Debian instance. Tested with Ubuntu 14.04 & 12.04 and Debian 8 & 7.
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
sudo apt-get update
sudo apt-get install memcached python-dev python-pip sqlite3 libcairo2 \
libcairo2-dev python-cairo pkg-config
sudo pip install -U pip
sudo pip install uwsgi
sudo adduser graphite
sudo su graphite
cd ~
$ wget http://tengine.taobao.org/download/tengine-1.3.0.tar.gz
$ wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.0.1.tar.gz
$ wget http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz
$ tar zxvf libunwind-1.0.1.tar.gz && cd libunwind-1.0.1
$ CFLAGS=-fPIC ./configure
$ make CFLAGS=-fPIC
$ sudo make CFLAGS=-fPIC install
$ cd ..
@ildus
ildus / gist:1126946
Created August 5, 2011 05:07 — forked from hunterloftis/gist:973973
Zepto + Mustache + KnockoutJS starting point
ko.mustacheTemplateEngine = function () {
this['getTemplateNode'] = function (template) {
var templateNode = document.getElementById(template);
if (templateNode == null)
throw new Error("Cannot find template with ID=" + template);
return templateNode;
}
this['renderTemplate'] = function (templateId, data, options) {
@ildus
ildus / pgsql_change_template_1.sql
Created August 3, 2011 08:45 — forked from EmmanuelOga/pgsql_change_template_1.sql
change postgresql template1 db encoding to utf8 (unicode) by dropping it and recreating from template0
# change postgresql template1 db encoding to utf8 (unicode) by dropping it and recreating from template0
UPDATE pg_database SET datistemplate=false WHERE datname='template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
@ildus
ildus / runner.py
Created July 8, 2011 03:44 — forked from NetAngels/runner.py
Extremely fast Django test runner
# -*- coding: utf-8 -*-
"""
Extremely fast Django test runner, based on the idea that your database schema
and fixtures are changed much more seldom that your code and tests. All you
need is to make sure that your "quickstart.sqlite" database file is always up
to date.
BEWARE: Don't run this test runner on production server. It assumes that you
use only one database configured as "default", and its db engine is SQLite.
Otherwise your tests can eat your data!
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal