Skip to content

Instantly share code, notes, and snippets.

View Samathy's full-sized avatar

Samathy Barratt Samathy

View GitHub Profile

Keybase proof

I hereby claim:

  • I am samathy on github.
  • I am samathy (https://keybase.io/samathy) on keybase.
  • I have a public key whose fingerprint is 1553 E90C EAFD D5A9 BA8F D7A2 9581 9B31 6E5D 5011

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am samathy on github.
* I am samathy (https://keybase.io/samathy) on keybase.
* I have a public key whose fingerprint is 04A6 D3A6 0F52 4A12 7D43 6633 3584 0BB4 8E6D 217A
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am samathy on github.
  • I am samathy (https://keybase.io/samathy) on keybase.
  • I have a public key whose fingerprint is 04A6 D3A6 0F52 4A12 7D43 6633 3584 0BB4 8E6D 217A

To claim this, I am signing this object:

#include <stdlib.h>
struct test
{
char c;
char i;
};
int main()
@Samathy
Samathy / dlangSillyStringComparasonError.d
Created February 28, 2016 18:48
One change in character completly changes the behaviour of this.
import std.string;
import std.stdio;
void main()
{
string s ="string";
string[4] c = ['a','g','t','s'];
string[4] d = ["a","g","t","s"];
@Samathy
Samathy / git_pull_dirs.fish
Created December 24, 2016 17:22
Small script to run 'git pull' in all subdirectories of the calling directory. (useful for updating plugins)
for dir in (ls)
cd $dir
if not ls .git
cd ../
continue
end
git pull
cd ../
end
@Samathy
Samathy / Arduino_ArchLinux_libtinfo_missing
Last active February 3, 2017 19:35
Fix for -> Uploading a sketch to an Arduino Nano fails on Arch Linux 03.02.2017
Attempting to upload an Arduino sketch to an Arduino Nano fails with the error: 'Failed to find libtinfo.so'
libtinfo is a dependency of avrdude. libtinfo (as far as I can tell) is a depreciated lib who's functionality is now part of, and shipped with, ncurses.
A dependency of Arduino, avrdude, uses the no longer avalible libtinfo.so.
The Arch AUR Package 'libtinfo' symlinks the relevent files, but does not fix the issue.
#Fix
===========
sudo pacman -S avrdude
@Samathy
Samathy / fish_git_prompt_build_status.fish
Created February 24, 2017 11:24
Change the colour of the fish shell git prompt if source files are newer than build files. Set your prompt to fish_git_prompt then. Add this line to the bottom of ~/.config/fish/functions/fish_prompt.fish
 #Tests if source files listed are newer than the build
    set currentTime  0
    set rebuild false
    if test -e (pwd)"/"srcList.fish; and test -e (pwd)"/"buildList.fish
        for file in (strings (pwd)"/"srcList.fish)
#include <CapacitiveSensor.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define CAPSENSORPIN 3
#define CAPCPIN 2
#define THERMRESISTORVAL 10000
@Samathy
Samathy / dumppdfcomments.py
Created January 5, 2018 18:50
Python Script to extract highlighted text from PDFs. Uses python-poppler-qt4. Updated [1] to Python 3 [1] https://stackoverflow.com/questions/21050551/extracting-text-from-higlighted-text-using-poppler-qt4-python-poppler-qt4
import popplerqt4
import sys
import PyQt4
def main():
doc = popplerqt4.Poppler.Document.load(sys.argv[1])
total_annotations = 0
for i in range(doc.numPages()):