Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
DSTDIR=$1
WPLATESTGZ=$(mktemp)
wget -O $WPLATESTGZ http://wordpress.org/latest.tar.gz
#cp -v latest.tar.gz $WPLATESTGZ
WPLATESTDIR=$(mktemp -d)
@TheBits
TheBits / o.py
Created September 5, 2010 17:28
# coding=utf-8
import re
# simple css parser
SELECTOR = '^\s*([#-_\.a-z\s:\(\)]+?)\s*({)'
PROPERTIES = '^\s*([-a-z]*?\s*:?\s*.*?)\s*(})'
SELECTOR_SEPARATOR = ','
PROPERTIES_SEPARATOR = ';'
var a = 10;
loop = setInterval( fadeout, 100 );
function fadeout() {
if( a > 0 ) {
a -= 2;
alert(a/10)
} else {
clearInterval( loop );
}
}
# -*- coding: utf-8 -*-
# ha-ha!
import itertools
DICTIONARY = 'abc123'
LIMIT = 3
out_file = 'out.log'
with open(out_file, 'w') as file:
for i in itertools.product(DICTIONARY, repeat=LIMIT):
@TheBits
TheBits / gist:923006
Created April 16, 2011 09:16
Small Basic plasma
window_x = 320
window_y = 240
'GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.Title = "Plasma"
GraphicsWindow.Width = window_x
GraphicsWindow.Height = window_y
GraphicsWindow.Show()
t = Math.GetRandomNumber(1000) * 1.0
#include <Windows.h>
int main(){
HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"), 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
{
TCHAR str[] = TEXT("D:\\putty.exe");
RegSetValueEx(hKey, TEXT("Putty"), 0, REG_SZ, (LPBYTE)&str, sizeof(str));
RegCloseKey(hKey);
From baf4f59e39027f9c94fa3f2a336fdada6ad757c7 Mon Sep 17 00:00:00 2001
From: TheBits <thebits@yandex.ru>
Date: Thu, 22 Sep 2011 01:58:56 +0400
Subject: [PATCH] ie fix
diff --git a/style.css b/style.css
index 453246e..88c31ed 100644
--- a/style.css
+++ b/style.css
with open('style.css') as input:
with open('ie.css', 'w') as output:
for line in input:
output.write(line)
if '-moz-' in line:
output.write(line.replace('-moz-', ' -ms-'))
@TheBits
TheBits / 1.c
Created March 19, 2012 20:13
c++ решения
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
// Задание 1
// В одномерном массиве, состоящем из п вещественных элементов, вычислить:
// 1) максимальный элемент массива;
// 2) сумму элементов массива, расположенных до последнего положительного элемента.
// Сжать массив, удалив из него все элементы, модуль которых находится в интервале [а,Ь]. Освободившиеся в конце массива элементы заполнить нулями.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<script src="http://yandex.st/jquery/1.8.0/jquery.min.js"></script>
<script src="underscore.js"></script>
<script src="backbone.js"></script>
<script src="rivets.js"></script>
</head>