Skip to content

Instantly share code, notes, and snippets.

View mirbehroznoor's full-sized avatar

Mir Behroz Noor mirbehroznoor

View GitHub Profile
@jogo3000
jogo3000 / my-disable-mouse.el
Created December 6, 2020 06:28
Temporarily disables mouse when I'm typing
;; Disable mouse on typing
(defvar jogo3000/mouse-disabled nil)
(use-package disable-mouse)
(defun jogo3000/disable-mouse ()
"Disable mouse."
(setq jogo3000/mouse-disabled t)
(global-disable-mouse-mode t))
(defun jogo3000/enable-mouse ()
@Jennyandhuang
Jennyandhuang / read_zipfile.py
Last active March 28, 2024 08:14
Read a zip file directly in Python
#import packages
import pandas as pd
import os
import zipfile
#change directory
os.chdir('/Users/ChiHuang/Documents/python/python_files')
os.listdir()
#read zip file
@tmalsburg
tmalsburg / Instructions.md
Last active August 16, 2022 13:58
LaTeX template for articles in APA format

Compile this template by executing the following in a command shell:

  pdflatex test && biber test && pdflatex test && pdflatex test

This template uses biblatex and biber instead of good old BibTeX. The bibliography files (*.bib) can have the same format (although biblatex allows using some interesting extensions). However, the biblatex+biber combo is much more powerful than good-old BibTeX (e.g. support for multiple bibliographies in one document) and comes with great documentation.

Suggestions for improvements welcome.

@ircykk
ircykk / gist:c35591ab0384f1d35a592ffa08029618
Created April 14, 2018 10:26
Linux bluetoothctl auto pair and connect device
#!/bin/bash
coproc bluetoothctl
echo -e 'scan on\n' >&${COPROC[1]}
sleep 3
echo -e 'remove AA:AA:AA:AA:AA:AA\n' >&${COPROC[1]}
sleep 1
echo -e 'pair AA:AA:AA:AA:AA:AA\n' >&${COPROC[1]}
sleep 1
@kleinschmidt
kleinschmidt / reftex-markdown.el
Last active March 15, 2022 09:19
Insert markdown (pandoc-citeproc) formatted citations using RefTeX
;; reftex in markdown mode
;; if this isn't already set in your .emacs
(setq reftex-default-bibliography '("/path/to/library.bib"))
;; define markdown citation formats
(defvar markdown-cite-format)
(setq markdown-cite-format
'(
(?\C-m . "[@%l]")
@rpmuller
rpmuller / parse_orgtable.py
Created November 19, 2015 20:22
Parse an orgmode table into a Pandas dataframe
def parse_orgtable(s):
"""Parse an org-table (input as a multiline string) into a Pandas data frame."""
# This didn't quite work, because spaces messed things up
#import cStringIO
#table = pd.read_table(cStringIO.StringIO(s),sep='|',skiprows=[1],skipinitialspace=True)
#table = table.drop(table.columns[[0,-1]],1)
# I suppose I could have simply run strip() on all of the resulting column names, since that was the problem
def parseline(l):
w = l.split('|')[1:-1]
return [wi.strip() for wi in w]
@drorata
drorata / gist:b05bfd59c45eec0470f6
Last active May 9, 2022 14:12
Nice output of pandas.DataFrame in org-mode
import pandas as pd
import numpy as np
from tabulate import tabulate

df = pd.DataFrame(np.random.random((4,3)), columns=['A','B','C'])
print("foo")
return(tabulate(df, headers="keys", tablefmt="orgtbl"))
@jburroni
jburroni / ProductSpace
Created January 31, 2015 22:38
Product Space and Argentina
{
"metadata": {
"name": "",
"signature": "sha256:c81db9b3da9f1e569785e363228b8b51d0b00b179b4637f15817ef495a5a5286"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@welbornprod
welbornprod / Embedded Python in BASH
Created August 14, 2014 23:22
A little trick to embed python code in a BASH script.
#!/bin/bash
# Here are some embedded Python examples using Python3.
# They are put into functions for separation and clarity.
# Simple usage, only using python to print the date.
# This is not really a good example, because the `date`
# command works just as well.
function date_time {
@kuanyui
kuanyui / resize-frame.el
Last active January 25, 2024 05:33
resize-frame.el --- A minor mode to resize frames easily.
;;; resize-frame.el --- A minor mode to resize frames easily. -*- lexical-binding: t; -*-
;; Copyright (C) 2014 kuanyui
;; Author: kuanyui <azazabc123@gmail.com>
;; Keywords: frames, tools, convenience
;; License: WTFPL 1.0
;;; Commentary: