Skip to content

Instantly share code, notes, and snippets.

View alibitek's full-sized avatar
🌱
Growing

Alex Bitek alibitek

🌱
Growing
View GitHub Profile
@alibitek
alibitek / generate_oauth_signature.pl
Created June 7, 2014 15:24
Generate oauth_signature parameter required in the Authorization HTTP header of the OAuth v1.0a protocol
#!/usr/bin/env perl
#
# Perl script to calculate the oauth_signature parameter as required by the OAuth protocol.
#
# Another method on UNIX systems is to use the tools available on the command line:
# Example:
# echo `printf '%s' "GET&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%253A%252F%252Fwww.mysite.com%26oauth_consumer_key%myconsumerkey%26oauth_nonce%3D1345644784337%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1345644784%26oauth_version%3D1.0" | openssl dgst -sha1 -hmac "ufWahmHEvWSC2KVJs96M5G7y1tbBU4gGH6Nq4JZsBs&" -binary | openssl base64` | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"'
#!/usr/bin/env python2
import SimpleCV
import time
c = SimpleCV.Camera(1)
js = SimpleCV.JpegStreamer()
while(1):
img = c.getImage()
img = img.smooth()
#include <iostream>
#include <fstream>
int main()
{
// bad
std::string text = "";
std::ifstream readFile ("q.txt", std::ifstream::in);
char c;
#!/usr/bin/env perl
use strict;
use warnings;
open my $fh, '<', "file.txt" or die $!;
my $total = 0;
my $count = 0;
while (<$fh>) {
QMainWindow,
QAbstractItemView,
QTreeView::branch,
QTabBar::tab{
color: #EAEAEA;
background: #333333;
font-size: 9pt;
}
QAbstractItemView::item:selected {
#!/usr/bin/env bash
# --------------------------------------
#
# Title: build-tcpdump
# Author: Loic Poulain, [email protected]
#
# Purpose: download & build tcpdump for arm android platform
#
# You have to define your android NDK directory before calling this script
#!/usr/bin/env python3
# ranwhen – Visualize when your system was running
#
# Requirements:
# - *nix system with last(1) installed and supporting the -R and -F flags
# - Python >= 3.2
# - Terminal emulator with support for Unicode and xterm's 256 color mode
#
#
#include <type_traits>
#include <string>
namespace detail {
using namespace std;
struct has_to_string_impl {
template<
typename T,
typename U = decltype(std::declval<const T&>().to_string()),
bool E = std::is_same<typename std::decay<U>::type, std::string>::value>
#include <iostream>
#include <vector>
class iterative_dfs
{
public:
// use a vector-of-vectors to represent adjacency list
typedef std::vector< int > nodes_t;
typedef std::vector< nodes_t > graph_t;
#include <thread>
#include <chrono>
#include <iostream>
using namespace std;
int main()
{
typedef chrono::high_resolution_clock clock;
clock::time_point start = clock::now();