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
@christopherhan
christopherhan / createSecureString.yaml
Last active August 25, 2022 18:35
Custom Lambda-backed CloudFormation resource to create a SecureString in ParameterStore
AWSTemplateFormatVersion: "2010-09-09"
Description: Put a SecureString parameter in SSM Parameter Store
Parameters:
KmsKeyId:
Type: String
Description: The KMS Key you want to use to encrypt the string.
SSMParameterKey:
Type: String
Description: The Parameter Store Key
SSMParameterValue:
@uhho
uhho / pandas_s3_streaming.py
Last active December 2, 2022 18:57
Streaming pandas DataFrame to/from S3 with on-the-fly processing and GZIP compression
def s3_to_pandas(client, bucket, key, header=None):
# get key using boto3 client
obj = client.get_object(Bucket=bucket, Key=key)
gz = gzip.GzipFile(fileobj=obj['Body'])
# load stream directly to DF
return pd.read_csv(gz, header=header, dtype=str)
def s3_to_pandas_with_processing(client, bucket, key, header=None):
@codspire
codspire / getting-started-with-superset-airbnb-data-exploration-platform.md
Last active February 12, 2024 21:41
Getting Started With Superset: Airbnb’s data exploration platform

Getting Started With Superset: Airbnb’s data exploration platform

Update Python and PIP versions on EC2 (Amazon AMI)

At the time of writing, Python v3.5 and PIP v9.0.1 were available on AWS EC2.

sudo yum update -y
sudo yum install python35 -y
@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', ''))
@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.
@saurabhshri
saurabhshri / pip.md
Last active September 24, 2023 11:07
Install and use pip in a local directory without root/sudo access.

Install and use pip in a local directory without root/sudo access.

Why?

Many users when are given server access, do not have root (or sudo) privileges and can not simply do sudo apt-get install python-pip . Here's an easy way you can install and use pip without root (or sudo) access in a local directory. Note : This works without easy_install too.

How?

@jgdoncel
jgdoncel / fn_remove_accents.sql
Last active April 5, 2024 13:00
MySQL Function to remove accents and special characters
DROP FUNCTION IF EXISTS fn_remove_accents;
DELIMITER |
CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)
BEGIN
SET @textvalue = textvalue COLLATE utf8_general_ci;;
-- ACCENTS
SET @withaccents = 'ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒ';
@g0t4
g0t4 / _README.md
Created November 30, 2016 03:46
Setting up a Docker Hub registry mirror on a Synology NAS

Instructions

  • Save the docker-compose.yml and config.yml in the same directory on one of your volumes on the NAS.
  • SSH in and use docker-compose up -d
  • Test the mirror with curl --head http://NAS-IP:55000
  • Start up docker daemons with the following option or put this in the daemon config file or copy into Docker for Mac/Windows settings. --registry-mirror=http://NAS-IP:55000
  • Pull an image and then check that it is cached in your mirror with curl http://NAS-IP:55000/v2/_catalog
    • or check that a large image isn't slow after the first pull :)

Notes

@tzmartin
tzmartin / embedded-file-viewer.md
Last active April 15, 2024 06:30
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@alopresto
alopresto / gpg_git_signing.md
Last active January 18, 2024 22:42
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)