Skip to content

Instantly share code, notes, and snippets.

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

Aleksandr Tihomirov zet4

🏠
Working from home
View GitHub Profile
@bergantine
bergantine / gist:1171682
Last active July 11, 2023 01:42
Python Image Encoding in Data URI Scheme Base 64. #python #base64
data_uri = open("sample.png", "rb").read().encode("base64").replace("\n", "")
# HTML Image Element
img_tag = '<img alt="" src="data:image/png;base64,{0}">'.format(data_uri)
print img_tag
# CSS Background Image
css = 'background-image: url(data:image/png;base64,{0});'.format(data_uri)
print css
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
@rikusalminen
rikusalminen / cube.glslv
Last active January 26, 2022 15:24
Cube vertex shader - usage: glDrawArrays(GL_TRIANGLES, 0, 36), disable all vertex arrays
#version 420
uniform mat4 projection_matrix;
uniform mat4 model_matrix;
void main()
{
int tri = gl_VertexID / 3;
int idx = gl_VertexID % 3;
int face = tri / 2;
@segphault
segphault / app.py
Created December 5, 2014 19:14
Flask application that serves RethinkDB data in CSV format
#!/usr/bin/env python
from csvkit.convert.js import json2csv
from collections import OrderedDict
from flask import Flask
import rethinkdb as r
import json, StringIO
config = {
"port": 8096,
@segphault
segphault / main.go
Created February 10, 2015 20:53
An IRC bot written in Go that provides notification when a RethinkDB cluster experiences issues
package main
import (
"code.google.com/p/gcfg"
"fmt"
r "github.com/dancannon/gorethink"
irc "github.com/fluffle/goirc/client"
"log"
"strings"
)
@msoap
msoap / script.go
Last active October 8, 2022 17:23
Run Go program as script
//usr/bin/env go run $0 "$@"; exit
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Hello world!")
@lepinkainen
lepinkainen / desktop.boxstarter
Last active January 23, 2016 13:21
Boxstarter script
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
# Development
cinst -y powershell
cinst -y githubforwindows
cinst -y python3
cinst -y git.commandline
cinst -y sublimetext3
# Media
from tkinter import *
import asyncio
from functools import wraps
import websockets
def runloop(func):
'''
This decorator converts a coroutine into a function which, when called,
runs the underlying coroutine to completion in the asyncio event loop.
'''
@jinzhu
jinzhu / main.go
Created October 1, 2015 00:07
handle postgres json with gorm
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
func main() {
import pyparsing as pp
token = pp.Word(pp.alphanums + '_-.')
command = pp.OneOrMore(token)
separators = ['1>>', '2>>', '>>', '1>', '2>', '>', '<', '||',
'|', '&&', '&', ';']
separator = pp.oneOf(separators)