Skip to content

Instantly share code, notes, and snippets.

@grhawk
grhawk / i-Pi
Last active May 10, 2016 10:55
i-Pi input editing
#!/bin/bash
# To edit file in place use the '-L' option wih the ed command
# Name of the file to edit
namefile='input_hexamer_book.xml'
# Assign the name of the ffsocket to a variable
ffname=`xmlstarlet sel -t -v "/simulation/ffsocket/@name" $namefile`
@grhawk
grhawk / threading_1.py
Created August 31, 2016 08:52
A background thread in python with signal control
import threading
import time
from sys import stdout
# Only data wihtin a class are actually shared by the threads
class Counter(object):
counter = 0
stop = False
# Function that will be executed in parallel with the rest of the code
@grhawk
grhawk / English all 1-grams
Created September 28, 2017 16:38 — forked from Kroid/English all 1-grams
Google Books Ngrams
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-1.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-2.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-0.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-3.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-4.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-5.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-6.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-7.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-8.gz
http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-1gram-20120701-9.gz
@grhawk
grhawk / jwtRS256.sh
Created January 22, 2018 15:50 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@grhawk
grhawk / EmacsKeyBinding.dict
Created March 11, 2020 11:23 — forked from jwreagor/EmacsKeyBinding.dict
Global Emacs Key Bindings for OS X
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
* BEWARE:
* This file uses the Option key as a meta key. This has the side-effect
* of overriding Mac OS keybindings for the option key, which generally
@grhawk
grhawk / bumpme
Last active March 12, 2020 15:09
Thu Mar 12 15:08:56 UTC 2020
@grhawk
grhawk / hdoc Dockerfile
Created May 4, 2023 23:23
Dockerfile for hdoc image
FROM ubuntu:jammy
LABEL "Mainteiner"="Riccardo Petraglia"
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get install -y git build-essential meson llvm cmake clang libclang-dev libclang-cpp-dev xxd pkg-config openssl libssl-dev
RUN git clone https://github.com/hdoc/hdoc.git
WORKDIR /hdoc
RUN ls -l && sleep 5
RUN git checkout `git tag -l | tail -1`
RUN meson build
RUN ninja -j 4 -C build