Skip to content

Instantly share code, notes, and snippets.

View Deadlyelder's full-sized avatar

Sankalp Deadlyelder

View GitHub Profile
@Deadlyelder
Deadlyelder / indent_correct.md
Created June 27, 2019 12:12
Dirty script to clean python indents

Quickyl correct the indentation issues in a given python file

perl -i.bak -pe "s/\t/' 'x(8-pos()%8)/eg" filename.py
names = ['baby', 'mommy', 'daddy', 'gramdma', 'grandpa', 'Let\'s go hunt']
for name in names:
for i in range(3):
if name == names[5]:
print(f'{name},'+ ' doo '*4)
else:
print(f'{name.title()} shark,'+ ' doo'*4)
if name == names[5]:
print(name)
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Blah</title>
<script src="./node_modules/web3/dist/web3.min.js"></script>
</head>
@Deadlyelder
Deadlyelder / stand_lib.md
Created October 17, 2018 08:46
List of standard C libraries for reference of code parsing
Name From Description
<assert.h> Contains the assert macro, used to assist with detecting logical errors and other types of bug in debugging versions of a program.
C99 A set of functions for manipulating complex numbers.
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
sudo apt-get update
sudo apt-get install -y clang-6.0
@Deadlyelder
Deadlyelder / git_diff_only_changes.sh
Last active September 13, 2018 09:26
Dirty script to get diff in more systematic manner (without noise) for AST
git diff <hash-commit-1>:<fillename> <hash-commit-1>:<filename> | gawk 'match($0,"^@@ -([0-9]+),[0-9]+ [+]([0-9]+),[0-9]+ @@",a){left=a[1];right=a[2];next}
/^(---|\+\+\+|[^-+ ])/{print;next};\
{line=substr($0,2)};\
/^-/{print "-" left++ ":" line;next};\
/^[+]/{print "+" right++ ":" line;next};\
{print "(" left++ "," right++ "):"line}' | grep -v '^+++' | grep -v '^---' | grep -v 'diff' | grep -v 'index'
@Deadlyelder
Deadlyelder / git_get.sh
Created September 10, 2018 15:19
GIT_EXTERAL_DIFF script
#! /bin/sh
path=$1
old_file=$2
old_hex=$3
old_mode=$4
new_file=$5
new_hex=$6
new_mode=$7
@Deadlyelder
Deadlyelder / Github_search_commits.py
Created July 20, 2018 09:39 — forked from o8r/Github_search_commits.py
Add /search/commits to pygithub
# Define search function because pygithub does not support /search/commits API yet.
import github
def __Github_search_commits(self, word, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **kwargs):
"""
:calls: `GET /search/commit`
:param str word: string search keyword
:param str sort: string ('author-date', 'commiter-date') (default: best match)
:param str order: string ('desc', 'asc') (default: 'desc')
:param dict kwargs: dictionary including query parameter set
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Commit`
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill
@Deadlyelder
Deadlyelder / say_all.sh
Created April 28, 2018 15:16
A quick script that speaks hello in all available voices in the say command.
#!/bin/bash
while read voice
do
say -v $voice hello; echo $voice;
done < <(say -v '?' | awk '{print $1}')