Skip to content

Instantly share code, notes, and snippets.

View siraj's full-sized avatar
💭
I may be slow to respond.

Siraj Razick siraj

💭
I may be slow to respond.
View GitHub Profile
@siraj
siraj / amqpconsumer
Created September 10, 2020 14:02
pika bug
import logging
import pika
import time
LOG_FORMAT = ('%(levelname) -1s %(asctime)s %(name) -1s %(funcName) '
'-1s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
user="user"
@siraj
siraj / __main__.py
Created March 24, 2020 16:47 — forked from drgarcia1986/__main__.py
Example of OAuth2 autentication server with Client Credentials grant (using python-oauth2 and tornado)
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Diego Garcia'
import tornado.web
import tornado.ioloop
import oauth2.tokengenerator
import oauth2.grant
import oauth2.store.redisdb
import oauth2.store.mongodb
@siraj
siraj / init_window.c
Created September 17, 2019 04:42 — forked from Miouyouyou/init_window.c
A very ugly Wayland EGL OpenGL example
// gcc -o test init_window.c -I. -lwayland-client -lwayland-server -lwayland-client-protocol -lwayland-egl -lEGL -lGLESv2
#include <wayland-client.h>
#include <wayland-server.h>
#include <wayland-client-protocol.h>
#include <wayland-egl.h> // Wayland EGL MUST be included before EGL headers
#include "init_window.h"
#include "log.h"
#include <string.h>
@siraj
siraj / vin_validation.py
Created June 19, 2019 20:07 — forked from only-entertainment/vin_validation.py
Validate a VIN using Python
class VINLookupForm(Form):
"""
Lookup a VIN form
"""
vin = TextField(u'Enter VIN',
validators=[validators.Required(u'VIN is required for lookup.')])
def validate_vin(self, field):
"""
Validate a VIN against the 9th position checksum
@siraj
siraj / apple-shadow.css
Created March 2, 2017 20:48 — forked from nrrrdcore/apple-shadow.css
Bending Shadows Backwards: Apple.com's Container CSS Sorcery
.shadow-stuff {
-moz-border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
-webkit-border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
-moz-box-shadow: rgba(0,0,0,.30) 0 2px 3px;
-webkit-box-shadow: rgba(0,0,0,.30) 0 2px 3px;
box-shadow: rgba(0,0,0,.30) 0 2px 3px;
}
.container {
std::wstring StringConverter::StringToWideString(const std::string& s) {
int len = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.length(), NULL, 0);
std::wstring ws(L"", len);
wchar_t* pWSBuf = const_cast<wchar_t*>(ws.c_str());
MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, pWSBuf, len);
return ws;
}
std::string StringConverter::WideStringToString(const std::wstring& ws) {
int len = WideCharToMultiByte(CP_UTF8, 0, ws.c_str(), ws.length(), 0, 0, NULL, NULL);
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
@siraj
siraj / goaccess.py
Created November 8, 2016 09:11 — forked from nagyv/goaccess.py
A python script for downloading and processing Amazon S3 logs using goaccess
#!/bin/python
import os
from boto.s3.connection import S3Connection
import subprocess
from datetime import datetime, date
import argparse
import tempfile
import json
parser = argparse.ArgumentParser(description="Downloads logs from S3, and parses them with goaccess.")
@siraj
siraj / thinkpad-trackpoint-speed.mkd
Created January 31, 2016 07:57 — forked from noromanba/thinkpad-trackpoint-speed.mkd
change pointer speed of Trackpoint on Thinkpad T60

Thinkpad Trackpoint speed configuration on Linux

change pointer speed of Trackpoint on Thinkpad

works well T60 with Ubuntu 13.10 and Ubuntu 14.04 LTS

how to change

speed configration by write integer to file

0 <- slower ------------ faster -> 250

@siraj
siraj / build_cross_gcc
Last active September 20, 2015 19:25 — forked from preshing/build_cross_gcc
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.