Skip to content

Instantly share code, notes, and snippets.

@certik
certik / a.f90
Created January 23, 2012 21:30
type(c_ptr) Example
program a
use types, only: dp
use compute, only: init, register_func, run, eq, destroy, get_context
use iso_c_binding, only: c_ptr, c_loc, c_f_pointer
type my_data
! Material coefficients:
real(dp) :: a11, a12, a21, a22
! There can be a lot of variables and big arrays here, this needs
! to be passed around by reference.
@fwenzel
fwenzel / install_makemkv.sh
Last active January 21, 2021 14:10
A convenient little script to install MakeMKV on Linux
#!/bin/bash
if [ "$1" == "" ]; then
echo "Usage: $0 1.8.0"
echo "to download and install MakeMKV 1.8.0"
exit 1
fi
# Collect sudo credentials
sudo -v
@shimofuri
shimofuri / imap_monitor
Created December 20, 2012 22:04
Python script for monitoring an IMAP folder
Each existing unread and subsequent new emails after the script is started are
passed as Mail objects to "process_email" function.Function header is provided
but processing implementation is left to the user. Error logs are currently sent
to a rotating log file (in the same directory as the script) and to STDOUT.
Instead of polling or checking the server for new emails every now and then,
IMAP IDLE check is utilized. Ensure that the IMAP server supports IDLE command
and allows at least 5 minutes of idling*** and uses the default ports for this
script to work. Tested to work with Gmail and default installations of MS
Exchange Server.
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@dankrause
dankrause / _hover_example.py
Last active March 8, 2024 18:31
Example code to use the (unofficial, unsupported, undocumented) hover.com DNS API.
import requests
class HoverException(Exception):
pass
class HoverAPI(object):
def __init__(self, username, password):
params = {"username": username, "password": password}
r = requests.post("https://www.hover.com/api/login", params=params)
@lisamelton
lisamelton / encode.sh
Last active March 31, 2024 21:13
This is the shell script I use to drive HandBrakeCLI to re-encode video files in a format suitable for playback on Apple TV, Roku 3, iOS, OS X, etc.
#!/bin/bash
# encode.sh
#
# Copyright (c) 2013 Don Melton
#
# This version published on June 7, 2013.
#
# Re-encode video files in a format suitable for playback on Apple TV, Roku 3,
# iOS, OS X, etc.
@jshahbazi
jshahbazi / fmincg.f90
Created May 31, 2014 22:17
fmincg minimization function ported to Fortran
real function fmincg(length, nn_params, input_layer_size, hidden_layer_size, num_labels, inputdata, y, lambda)
implicit none
! Copyright (C) 2001 and 2002 by Carl Edward Rasmussen. Date 2002-02-13
! (C) Copyright 1999, 2000 & 2001, Carl Edward Rasmussen
!
! Permission is granted for anyone to copy, use, or modify these
! programs and accompanying documents for purposes of research or
! education, provided this copyright notice is retained, and note is
! made of any changes that have been made.
@bllchmbrs
bllchmbrs / markdown to quiver.py
Created December 2, 2014 01:52
Convert Markdown Files to Quiver notes
import argparse
import json
import re
import os
from time import time
parser = argparse.ArgumentParser(description='Convert to Quiver Format')
parser.add_argument("src", help="The Source File You want to Convert")
args = parser.parse_args()
cells = []
@DianaEromosele
DianaEromosele / Change "origin" of your GIT repository
Created August 7, 2016 00:31
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@LucaCappelletti94
LucaCappelletti94 / Firing up LaTex on macOS.md
Last active May 21, 2024 14:05
Firing up Latex on macOS

Firing up LaTex on macOS 🔥

As I'm writing this small tutorial, I assume you've read my previous one about setting up macOS, so if for any tool I'll use without explanation, look to that other article.

MacTex

The full version IS NOT MANDATORY, as in the tutorial that follows I installed the smaller version of MacTeX and proceded installing every needed dependency. Installing the complete package is about ~3.5GB of download and ~5GB on disk, the smaller one is just about 80MBs.

Click here to download the complete version or here to download the smaller version.

Gnuplot