Skip to content

Instantly share code, notes, and snippets.

View lmatt-bit's full-sized avatar
🎱

lmatt lmatt-bit

🎱
View GitHub Profile
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@lmatt-bit
lmatt-bit / load_mode.cpp
Created March 1, 2017 08:14
tensorflow: python save model, cpp load model & weight
#include "tensorflow/core/public/session.h"
#include "tensorflow/core/platform/env.h"
using namespace tensorflow;
int main(int argc, char* argv[]) {
// Initialize a tensorflow session
Session* session;
Status status = NewSession(SessionOptions(), &session);
if (!status.ok()) {
std::cout << status.ToString() << "\n";
@lmatt-bit
lmatt-bit / load_graph.py
Created February 28, 2017 08:29
tensorflow 0.12 save & load graph
import tensorflow as tf
import numpy as np
import os
with tf.Session() as sess:
md = "./models/"
fgn = "model.ckpt"
fgp = os.path.join(md, fgn)
saver = tf.train.import_meta_graph(fgp + ".meta")
saver.restore(sess, fgp)
@lmatt-bit
lmatt-bit / screen.md
Created January 10, 2017 07:22 — forked from fredrick/screen.md
GNU Screen Cheat Sheet

#GNU Screen Cheat Sheet

##Basics

  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dow
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
  • ctrl a d -> detach win­dow
@lmatt-bit
lmatt-bit / tmux-cheatsheet.markdown
Created December 22, 2016 02:20 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@lmatt-bit
lmatt-bit / gist:03fa295129bc2523a7da34f4e665e323
Created October 22, 2016 07:14 — forked from drorata/gist:146ce50807d16fd4a6aa
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})
@lmatt-bit
lmatt-bit / test.scala
Last active October 21, 2016 05:49
Scala common actions
// Read output from process' cosole
def getOriginalSentences(more_params: String): Seq[String] = {
val pb = Process("python", Array("test.py",more_params))
pb.lineStream
}
// Cast
val a_int = 1
a_int.asInstanceOf[java.lang.Integer]
@lmatt-bit
lmatt-bit / RunSuave.fs
Created August 4, 2016 07:27
FSharp Script TO Run Local Http Server
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
open Suave
open Suave.Filters
open Suave.Operators
open Suave.Successful
open Suave.Sockets
open System.Net
@lmatt-bit
lmatt-bit / useful_pandas_snippets.py
Created April 22, 2016 00:14 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@lmatt-bit
lmatt-bit / TestAsync.cs
Created April 3, 2016 06:26
Test Async in CSharp
class Program
{
static async Task DoSomethingAsync()
{
int val = 13;
await Task.Delay(TimeSpan.FromSeconds(1));
val *= 2;