Skip to content

Instantly share code, notes, and snippets.

View sebastiz's full-sized avatar

Gastroenterology Data Science sebastiz

View GitHub Profile
@sebastiz
sebastiz / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sebastiz
sebastiz / gist:ddf628cc8497096c3bbe
Last active August 29, 2015 14:21 — forked from Migweld/gist:512fda1689f0639d44ff
Loop over directories, regex and remove those with numbers
#!/bin/bash
$PARENTDIR = 'parent_dir here'
#Get a list of dirs/files in parent directory, pipe to egrep and select only directories then pipe to awk to get the 9th field (directory name). Check your shell to make sure $9 is actually the directory name
DIRS=`ls -l $MYDIR | egrep '^d'`| | awk '{print $9}'
# Loop through our directories
#!/bin/bash
provider=virtualbox
# Loop over boxes
for box in ~/.vagrant.d/boxes/*; do
# Create provider directory to contain files
mkdir $box/$provider/
@sebastiz
sebastiz / gist:10a9c975a8054df2c262
Last active August 29, 2015 14:21 — forked from stvkoch/gist:3151248
Useful one line perl scripts
Useful One-Line Scripts for Perl Jan 28 2012 | version 1.08
-------------------------------- ----------- ------------
Compiled by Peteris Krumins (peter@catonmat.net, @pkrumins on Twitter)
http://www.catonmat.net -- good coders code, great reuse
Latest version of this file is always at:
http://www.catonmat.net/download/perl1line.txt
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic HTML5 Template</title>
<link href="stylesheets/style.css" rel="stylesheet" type="text/css" media="screen" />
<script src="example.js"></script>
</head>
<body>
@sebastiz
sebastiz / FileCommandsRuby.rb
Last active January 18, 2016 16:17 — forked from coetry/gist:6e110092eb0943ddc0d4
File Commands in Ruby
File.open "file.json", "w+" do |file|
file.puts Hash.to_json
end
#This writes a whole string to a file (string is the output of method mypage.makePage)
File.open("/Users/sebastianzeki/Desktop/MyRubyHTML.html", 'w') { |file| file.write(mypage.makePage)}
File.open("/path/to/file").each { |line|
puts line
}
@sebastiz
sebastiz / Bookmarks_Ruby
Last active August 29, 2015 14:22 — forked from a2bfay/guides.text
Bookmarks-Ruby
RUBY!
n.b. Class/module index at lower left in ruby-doc explanation pages (cf. Time, Math, etc.)
******************************************************************************************
http://ruby-doc.org/core-2.1.2/
Searchable list of methods
http://ruby-doc.org/core-2.1.2/String.html
@sebastiz
sebastiz / RailsModel.md
Last active August 29, 2015 14:23 — forked from rstacruz/index.md
List of Rails models gists

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

#A truck load of code snippets
####################################################################################################################################################################################
####################################################################################################################################################################################
####################################################################################################################################################################################
################################################ System tasks ######################################################################################################################
####################################################################################################################################################################################
###################################################################################
@sebastiz
sebastiz / gist:4bfb7a96adc1ed21998c540f82cf03f1
Created April 4, 2021 18:08 — forked from briatte/gist:ad24bb323d2603dbdd3af35086147c83
R to Python: Data wrangling with dplyr and pandas
R to python useful data wrangling snippets
The dplyr package in R makes data wrangling significantly easier.
The beauty of dplyr is that, by design, the options available are limited.
Specifically, a set of key verbs form the core of the package.
Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe.
Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R.
The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).
dplyr is organised around six key verbs