Skip to content

Instantly share code, notes, and snippets.

View psachin's full-sized avatar
🚀
Evolving

Sachin psachin

🚀
Evolving
View GitHub Profile
@psachin
psachin / libv4l2.txt
Last active August 29, 2015 14:07
Compiling libv4l2 for wm8880 netbook
- Download source from: https://drive.google.com/file/d/0B-PZvjWWRSpQbldxaFhIR2hEeG8/view?usp=sharing
- Extract the file using
tar -xvzf v4l2.tar.gz
- Visit 'v4l2/libv4l' directory
cd v4l2/libv4l
make clean
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.4.5 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_HAVE_PWM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
CONFIG_GENERIC_CLOCKEVENTS=y
@psachin
psachin / Makefile
Last active August 29, 2015 14:17 — forked from jvns/Makefile
obj-m += hello-packet.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
@psachin
psachin / Google HN
Created April 2, 2015 09:17
l337 50f7w4r3 3n61n33r
#!/usr/bin/env python
# https://www.google.com/about/careers/search?src=Online/Google+Website/ap2015?utm_source=hacker-news&utm_medium=other&utm_campaign=Online/Social/hacker-news#!t=jo&jid=98895001&
en_dict = {
'a': '4',
'b': 'b',
'c': 'c',
'd': 'd',
'e': '3',
'f': 'f',
@psachin
psachin / python-insert-utf8
Created May 16, 2015 05:27
python-insert-utf8
(defun python-insert-utf8()
"Insert default uft-8 encoding for python"
(interactive)
(newline)
(goto-char (point-min))
(insert "# -*- coding: utf-8 -*-")
(next-line))
(add-hook 'python-mode-hook 'python-insert-utf8)
@psachin
psachin / .bashrc
Created January 18, 2012 06:13 — forked from ralfebert/.bashrc
git settings
# Prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[31;38m\]\u@\h\[\033[00m\]:\[\033[31;38m\]\w\[\033[1;31m\]\$(parse_git_branch)\[\033[00m\] "
# Editor
export GIT_EDITOR='nano -Y patch'
@psachin
psachin / tcp.py
Last active October 29, 2015 06:54
Django template context processors
** django
- Variable defined in settings.py available to templates(templates
context processor)
Create =context_processors.py= in app directory. Say the
value of variable is =ADMIN_MEDIA_PREFIX=
#+BEGIN_SRC python -n
# app/context_processors.py
@psachin
psachin / reverse_iter.py
Last active November 7, 2015 06:12
reverse iterator
class ReverseIter:
def __init__(self, step):
self.step = step
def next(self):
if self.step == 0:
raise StopIteration
self.step -= 1
return self.step
def __iter__(self):
return self
@psachin
psachin / py_mail.py
Last active November 7, 2015 06:13
Python Gmail client
#!/usr/bin/env python
# Basic script for GMail.
import os
import smtplib
from email.MIMEText import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from secret import password
@psachin
psachin / screenshot-frame.el
Last active December 12, 2015 08:25
Take screeeshot from Emacs
(defun screenshot-frame ()
"Take screenshot.
Default image ~/screenshots/TIMESTAMP.png
Usage:
M-x screenshot-frame
Enter custom-name or RET to save image with timestamp"
(interactive)
(let* ((insert-default-directory t)