Skip to content

Instantly share code, notes, and snippets.

View ShikherVerma's full-sized avatar
👔
सख्त लौंडा

Shikher Verma ShikherVerma

👔
सख्त लौंडा
  • Earth
View GitHub Profile
SampleApplication/app/build/generated/source/apt/debug/com/shikherverma/sampleapplication/MainActivity_ViewBinding.java
# git clone https://github.com/ShikherVerma/ReverseEngineerAndroidLibraries.git ~/AndroidStudioProjects/SampleApplication
# cd ~/AndroidStudioProjects/SampleApplication
# git checkout lib/butterknife
@ShikherVerma
ShikherVerma / test.c
Created July 27, 2017 13:02
Example C program. gcc test.c; ./a.out; This verifies that strlen on unsigned char array gives the length of content and not the length of array.
#include <stdio.h>
#include <string.h>
static unsigned char push_cert_sha1[20];
int main() {
printf("Length = %d", strlen(push_cert_sha1));
sprintf(push_cert_sha1, "Hello");
printf("Length = %d", strlen(push_cert_sha1));
}
@ShikherVerma
ShikherVerma / Solution.java
Created July 27, 2017 12:53
Example Java program. Compile and run : javac Solution.java ; java Solution [args]
import java.io.*;
import java.util.*;
import java.math.*;
public class Solution {
private static final String TAG = Solution.class.getName();
public static void main(String... args) {
for(String s : args)
System.out.println(s);
}
@ShikherVerma
ShikherVerma / xdoscript.sh
Created July 27, 2017 12:49
A xdotool script to insert Tab in 600 lines. Just an example for future me. I don't remember where I used this script.
#!/bin/bash
WID=`xdotool search --title "Chromium" | head -1`
xdotool windowfocus $WID
for i in {1..600}
do
xdotool key Tab
xdotool key Enter
sleep 4
done
@ShikherVerma
ShikherVerma / git-redate.sh
Created July 27, 2017 12:45
Script to easily change commit and author date of commits. Usage `git redate --commits [[number of commits to view]]` Made by http://taterlabs.com/
#!/bin/bash
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-c| --commits)
COMMITS="$2"
shift
@ShikherVerma
ShikherVerma / git-http-server.js
Last active July 27, 2017 12:35
minimal git http server. Run with `node git-http-server.js` (npm modules : http, child_process, path, git-http-backend, zlib)
var http = require('http');
var spawn = require('child_process').spawn;
var path = require('path');
var backend = require('git-http-backend');
var zlib = require('zlib');
var server = http.createServer(function (req, res) {
var repo = req.url.split('/')[1];
var dir = path.join(__dirname, 'repos', repo);
var reqStream = req.headers['content-encoding'] == 'gzip' ? req.pipe(zlib.createGunzip()) : req;
@ShikherVerma
ShikherVerma / git-http-server.js
Created July 27, 2017 12:34
minimal git http server with npm modules : http, child_process, path, git-http-backend, zlib
var http = require('http');
var spawn = require('child_process').spawn;
var path = require('path');
var backend = require('git-http-backend');
var zlib = require('zlib');
var server = http.createServer(function (req, res) {
var repo = req.url.split('/')[1];
var dir = path.join(__dirname, 'repos', repo);
var reqStream = req.headers['content-encoding'] == 'gzip' ? req.pipe(zlib.createGunzip()) : req;
@ShikherVerma
ShikherVerma / verify-certificate.py
Last active July 27, 2017 12:45
verify git push ceritifcates $ verify-certificate.py path-to-latest-push-certificate
import sys
import os
import zlib
import re
import gnupg
import subprocess
def verify_signature(gpg, signature, content):
"""This function exists because python-gnupg failed me."""
# write signature to a file and get file stream 'rb'