Skip to content

Instantly share code, notes, and snippets.

View webysther's full-sized avatar
👨‍🔬
Can you solve the 3n + 1 problem?

Webysther Sperandio webysther

👨‍🔬
Can you solve the 3n + 1 problem?
View GitHub Profile
@he7d3r
he7d3r / conj-pt-er.js
Created September 4, 2014 14:19
JSON para "conj.pt.er"
// https://pt.wiktionary.org/wiki/Template:conj.pt
// https://pt.wiktionary.org/wiki/Template:conj.pt.er
// https://pt.wiktionary.org/wiki/Special:WhatLinksHere/Template:conj.pt?limit=500&namespace=10
/*var text = $('#wpTextbox1').val();
jsMsg( text.replace( /<noinclude>[\s\S]+?<\/noinclude>/g, '' ) );
$('#wpTextbox1').val().replace(/<noinclude>[\s\S]+?<\/noinclude>/g, '').match( /\{\{\s*conj\.pt\s*\|\s*título\s*=\s*([\s\S]+?)\s*\|\s*\{\{\{1\|?\}\}\}(.+?)\s*\|/ );
@shivaram
shivaram / dataframe_example.R
Created June 2, 2015 23:54
DataFrame example in SparkR
# Download Spark 1.4 from http://spark.apache.org/downloads.html
#
# Download the nyc flights dataset as a CSV from https://s3-us-west-2.amazonaws.com/sparkr-data/nycflights13.csv
# Launch SparkR using
# ./bin/sparkR --packages com.databricks:spark-csv_2.10:1.0.3
# The SparkSQL context should already be created for you as sqlContext
sqlContext
# Java ref type org.apache.spark.sql.SQLContext id 1
@nisrulz
nisrulz / loadcsv2dataframe.py
Created June 9, 2017 05:22
Read and load a csv file into pandas data frame
import pandas as pd
import csv
with open("<filename>.csv", 'r') as f:
with open("updated_file.csv", 'w') as f1:
f.next() # skip header line
f.next() # skip header empty line
for line in f:
f1.write(line.replace('\x00', ''))
@egpbos
egpbos / Python, King of data science.ipynb
Created August 29, 2018 07:40
Python, King of data science
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@granthenke
granthenke / hadoop-aliases.sh
Last active May 10, 2020 23:21
A file containing useful/shortened aliases for use in Hadoop
# Generic Aliases
alias ll='ls -latr' # List all file in long list format by modification time
alias ..='cd ..' # Go up one directory
alias ...='cd ../..' # Go up two directories
alias ....='cd ../../..' # Go up three directories
alias -- -='cd -' # Go back
alias c='clear' # Clear Screen
alias k='clear' # Clear Screen
alias cls='clear' # Clear Screen
alias _="sudo" # Execute with sudo
@ozanturksever
ozanturksever / get_uncompressed_size.py
Last active August 25, 2020 14:10
python get uncompressed size of a .gz file
def get_uncompressed_size(self, file):
fileobj = open(file, 'r')
fileobj.seek(-8, 2)
crc32 = gzip.read32(fileobj)
isize = gzip.read32(fileobj) # may exceed 2GB
fileobj.close()
return isize
@simecek
simecek / rmagic_example.ipynb
Last active January 16, 2021 13:29
How to add R code to your (IPython) Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pofider
pofider / 01-ebs.config
Created September 10, 2015 15:14
Attach EBS volume to amazon elastic beanstalk
# .ebextensions/01-ebs.config
commands:
01clear-if-unmounted:
command: if ! mount | grep /media/ebs_volume > /dev/nul; then rm -rf /media/ebs_volume; fi
02attach-volume:
command: aws ec2 attach-volume --region eu-central-1 --volume-id vol-ddb08e34 --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --device /dev/sdh
ignoreErrors: true
03wait:
command: sleep 10
04trymount:
@m4tthumphrey
m4tthumphrey / CronSchedule.php
Last active May 23, 2022 11:29
CronSchedule.php - Allows one to parse a cron expression into human readable text.
<?php
/*
* Plugin: StreamlineFoundation
*
* Class: Schedule
*
* Description: Provides scheduling mechanics including creating a schedule, testing if a specific moment is part of the schedule, moving back
* and forth between scheduled moments in time and translating the created schedule back to a human readable form.
*
* Usage: ::fromCronString() creates a new Schedule class and requires a string in the cron ('* * * * *', $language) format.
@snixon
snixon / security-group-cleanup.py
Last active August 25, 2022 18:08 — forked from TomRyan-321/security-group-cleanup.py
Fancy Security Group Cleanup
#!/usr/bin/env python
import os
import boto3
import argparse
import json
# `pip install -U PTable` will get you the right fork of PrettyTable
from prettytable import PrettyTable
from botocore.exceptions import ClientError