Skip to content

Instantly share code, notes, and snippets.

Avatar

Anil Kulkarni AnilRedshift

View GitHub Profile
@AnilRedshift
AnilRedshift / deloldtweets.py
Last active Jun 19, 2020 — forked from flesueur/deloldtweets.py
Delete (very) old tweets obtained from a twitter archive
View deloldtweets.py
#!/bin/python3
# Largely copied from http://www.mathewinkson.com/2015/03/delete-old-tweets-selectively-using-python-and-tweepy
# However, Mathew's script cannot delete tweets older than something like a year (these tweets are not available from the twitter API)
# This script is a complement on first use, to delete old tweets. It uses your twitter archive to find tweets' ids to delete
# How to use it :
# - download and extract your twitter archive (tweet.js will contain all your tweets with dates and ids)
# - put this script in the extracted directory
# - complete the secrets to access twitter's API on your behalf and, possibly, modify days_to_keep
# - delete the few junk characters at the beginning of tweet.js, until the first '[' (it crashed my json parser)
# - review the script !!!! It has not been thoroughly tested, it may have some unexpected behaviors...
@AnilRedshift
AnilRedshift / README.md
Last active Feb 22, 2018 — forked from jasonblanchard/README.md
Watching build mode on Create React App
View README.md

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app. You can either build the dev bundle once with build:dev, or continually rebuild it with watch

How to Use

Create a React app.

Put the script into scripts/build.js.

@AnilRedshift
AnilRedshift / download.py
Created Nov 2, 2017
download files from slack
View download.py
import os
from slackclient import SlackClient
import requests
slack_token = os.environ["SLACK_API_TOKEN"]
sc = SlackClient(slack_token)
if not os.path.exists('files'):
os.makedirs('files')
channels = sc.api_call("channels.list")["channels"]
@AnilRedshift
AnilRedshift / update_cloudfront_ssl.py
Created Oct 27, 2017
Updating a cloudfront SSL certificate via boto
View update_cloudfront_ssl.py
import boto3
import os
from copy import deepcopy
acm = boto3.client('acm')
cloudfront = boto3.client('cloudfront')
cf_ids = ['YOUR_CLOUDFRONT_ID_HERE', 'YOUR_SECOND_CLOUDFRONT_ID_HERE']
base = 'DIRECTORY_TO_YOUR SSL CERTS'
cert_arn = None
@AnilRedshift
AnilRedshift / Gemfile
Created Oct 17, 2017
Rails test setup
View Gemfile
group :test do
gem 'rspec-rails'
gem 'simplecov', require: false
gem 'rails-controller-testing'
gem 'shoulda-matchers'
gem 'faker'
gem 'capybara'
gem 'poltergeist'
gem 'factory_girl_rails'
@AnilRedshift
AnilRedshift / setup.sh
Last active Sep 26, 2017
Setting up eslint in atom
View setup.sh
#! /bin/bash
npm install -g eslint eslint-config-react-app babel-eslint eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
apm install linter linter-eslint
echo '{' > ~/.eslintrc
echo ' "extends": "react-app",' >> ~/.eslintrc
echo ' "env":' { >> ~/.eslintrc
echo ' "browser": true,' >> ~/.eslintrc
echo ' "jquery": true,' >> ~/.eslintrc
echo ' "jasmine": true' >> ~/.eslintrc
echo ' }' >> ~/.eslintrc
View first_initials.rb
def first_initials(names)
names.reduce({}) do |letters, name|
first_letter = name[0]
if letters[first_letter] == nil
letters[first_letter] = 1
else
letters[first_letter] += 1
end
letters
end
You can’t perform that action at this time.