This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hacks | |
+--------------------------------+---------------+-------------------+-----------------------+ | |
|Type |Formula |Example |Code Result | | |
| | | | | | |
+--------------------------------+---------------+-------------------+-----------------------+ | |
|1.Test of number being power of |x & (x – 1) |(e.g., 01011000 ⇒ |x = 8 result = 0, x = 9| | |
|2. | |01010000) |result = 8 | | |
| | | | | | |
| | | | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _categorize(type,dir) { | |
matches = ($9 ~ type) | |
if(matches) { | |
nlines++ | |
if(dir) { | |
query = sprintf("cp %s %s",$9,dir) | |
system(query) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Handling init-developmental mode stuffs | |
(defvar devel-file-extension-map | |
'(("c" c-mode) | |
("html" html-mode) | |
("py" python-mode) | |
("pl" perl-mode) | |
("php" php-mode) | |
("scm" scheme-mode) | |
("java" java-mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pattern from command Line | |
BEGIN { | |
pattern=ARGV[13] | |
_pattern=pattern | |
} | |
{ | |
matches = ($0 ~ _pattern) | |
if(matches) { | |
print "Matched Line " $0 "@ " FILENAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Move these stuffs to config, no need to check for last backed date. Run the script every week | |
DIR=('/home/sriramr/Mail/' '/home/sriramr/pub_webs/Wrk/cdapp/cdapp/') | |
FILES=('/home/sriramr/src/scratch' '/var/lib/iptable/active') | |
DROPBOX=('/home/sriramr/src/scratch' '/home/sriramr/src/notes/weekall.org' '/var/lib/iptables/active') | |
# Not used | |
CMN_BACKUP_FILE="lastbacked" | |
CMN_BACKUP_DIR="/store/bckup/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.gitignore b/.gitignore | |
index 7a5db30..e7c6a00 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -1,2 +1,8 @@ | |
.pc | |
build | |
+po/* | |
+share/ca-certs/Makefile | |
+share/sounds/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import pyaudio | |
import sys | |
import numpy as np | |
PyAudio = pyaudio.PyAudio | |
RATE = 8000 | |
WAVE = 1000 | |
data = ''' | |
##### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Comments Ldap directory search using python_ldap | |
import os | |
import sys | |
import ldap | |
#debuggin options if required | |
ldapmodule_trace_level = 0 | |
ldapmodule_trace_file = '' | |
basedn = "OU=Employees,OU=Domain Users,DC=domain,DC=com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#define usage() {printf("\n Usage %s file_name", argv[0]);} | |
int main(int argc, char *argv[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define bit_ext(val, m, n) \ | |
int k = 1 << (m-1); \ | |
k = k | (k -1); \ | |
k = k ^ (1 << (n + 1)); \ | |
int j = 1 << (n + 1); \ | |
j = j ^ (j - 1); \ | |
k = k ^ j; \ | |
val = val & k; \ |
OlderNewer