Skip to content

Instantly share code, notes, and snippets.

@Opiprog
Opiprog / gist:5685296
Last active December 17, 2015 22:49
Useful LaTex codes
%%%%%%% (1) ADDING HQ IMAGES TO LatexPDF %%%%%%
% The best ways I have found are through PDF or EPS formats (i.e. vector formats)
% Avoid bitmaps.
% NEVER WORK IN MS POWERPOINT! Can't export .EPS formats, only horrible bitmaps. Use OPEN OFFICE instead.
\usepackage{epstopdf}
%%%%%%% (2) SUBSCRIPT AND SUPERSCRIPT TOGETHER %%%%%%%
@Opiprog
Opiprog / gist:6039573
Created July 19, 2013 14:38
Solving ODE in Python
from scipy.integrate import odeint
from pylab import * # for plotting commands
def deriv(y,t): # return derivatives of the array y
a = -2.0
b = -0.1
return array([ y[1], a*y[0]+b*y[1] ])
time = linspace(0.0,10.0,1000)
yinit = array([0.0005,0.2]) # initial values
@Opiprog
Opiprog / UpdateCycleNum
Last active January 1, 2016 17:09
Excel VB Macro - Updating cycle numbers
Sub UpdateCycleNum()
Dim CellSelect As Long
Dim CycAdd As Long
Dim rng As Range
CellSelect = 1000
CycAdd = 67000
'Set the range in column A you want to loop through
@Opiprog
Opiprog / Pi_Bat_Timetest.py
Last active March 20, 2016 23:55
Recording Battery Life of RPi
# By J. Vlaskamp and M. Ali
import os
import sys
import time
import datetime
tstamp = time.time()
st = datetime.datetime.fromtimestamp(tstamp).strftime('Test staterd at %Y-%m-%d %H:%M:%S\n')
print st
@Opiprog
Opiprog / Kivy_HelloWorld.py
Created November 25, 2017 23:31
Kivy - Hello World
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
@Opiprog
Opiprog / gist:8bb6f491578d4f23540ccd98e85288c3
Created December 6, 2016 12:45
Convert xls to xlsx using Windows cmd
# Open a command prompt in windows and type the following
# This open the excelcnv.exe from the Office15 folder and converts MyFile.xls (from the in folder) to MyFile.xlsx (to the out folder)
"C:\Program Files (x86)\Microsoft Office\Office15\excelcnv.exe" -oice "C:\in\MyFile.xls" "C:\out\MyFile.xlsx”