Skip to content

Instantly share code, notes, and snippets.

View vireshas's full-sized avatar
:octocat:

Viresh Sanagoudar vireshas

:octocat:
View GitHub Profile
#!/usr/bin/env python
# Author: Chris Eberle <eberle1080@gmail.com>
# Watch for any changes in a module or package, and reload it automatically
import pyinotify
import imp
import os
class ModuleWatcher(pyinotify.ProcessEvent):
"""
@vireshas
vireshas / detect_utf8.c
Last active August 29, 2015 13:57
Detect no,of utf-8 chars in a line
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//utf-8 chars can be 4bytes long
#define U_MAX_BYTES 4
//counter to hold non ascii chars count
int count = 0;
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCg1PDVPVpqmhWqL1RLUeIjC6rHRF7CUP0g8Z2wvUaZ+gtr1xmKU6YOF3MfXOpD28rtLdHy97+AG4H56iEYH3hKOU9EabqrAQzEAxkaHX1v/fAQpfxsNzTPei7JfFOoJVmJHTSmuHJcGnkjIuiGtKxDbUcxU7Fw6TAfsN6913VfXiYJEdc3ycS7D/tRp/naGCsv8L0SbuiJveWDd+F0vIxQNamKpAYZ+xSRAC8rDK9pCPTWWhcbNZh8zrCp3KcIEGq5c+XGM4sv/Fzlijrgyq0VwBMorIU07aJv+Gv8C+qLm0E7tP1YZj0fsXmnERnRUdLcAoPqUoPYoJJLecAsKbzF viresh_sanagoudar@viresh-Latitude-E5410
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| bm | CREATE TABLE `bm` (
`id` int(11) NOT NULL DEFAULT '0',
`col` varchar(255) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
redis-cli
127.0.0.1:6379> get key3
"k1245135"
@vireshas
vireshas / pyrq.py
Created January 13, 2015 07:07
RQ internals
#reverse engineering RQ!!
import redis
import json
from functools import partial
import cPickle as pickle
import time
loads = pickle.loads
@vireshas
vireshas / .gitignore
Last active August 29, 2015 14:18 — forked from karmi/.gitignore
.DS_Store
*.log
tmp/
#!/usr/bin/env ruby
# Intent:
# counts DigitalIndia supporters(dp updates) in your feed
# Usage:
# digital_india_supporters.rb <pass access token here>
# access_token="your access token goes here" digital_india_supporters.rb
# If your access_token is expired, you can get a 400 bad request exception. Go get a fresh access_token in that case.
# Result:
# I found 24 supporters in my feed. Avg of 3/25 posts in my feeds were on digitalindia profile update.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCf+eR/l9PM67BG/7Ak7HZThO09cGDuBPP/9CSdjmn2HHg5OCTVJ56rWo83Fojy3v/HvksdPzdBJ1hhE0b42FazE4dbN4UoFc3UhcqzvJ/l8IuaQRsexN4ZqNcaUf4p1CNGWMXQfbqHsJkVhnmdW0KMusbV8yfzZSWuJrk4SKGZlxeMGhZBhb4ROV4ZKS/NTmKchrvVdonmb7TrPF8imP9yn3SSPi58ZRsam4icP8BUAFuD5q4DwTVmfs0P2n2Caza6ODb+XSVITzEah8KRlNWW7m9Ni5qG+n00oJqolbtmXX9a9FKu4x9VJ7JgozaYiD4xX4n4nJcKN0IAsPPd94bt asviresh@gmail.com
class A
attr_accessor :a, :c
def initialize(value)
self.a = value
end
def assign(start_time)
self.c = start_time