Skip to content

Instantly share code, notes, and snippets.

View benwoodward's full-sized avatar
💭
Working on spoken.app

Ben Woodward benwoodward

💭
Working on spoken.app
View GitHub Profile
@woodongk
woodongk / text_preprocessing.py
Last active July 10, 2022 07:35
Korean-Text-Preprocessing in Python
import re
from konlpy.tag import Mecab
from khaiii import KhaiiiApi
def remove_brackets(string, left_paren_type,right_paren_type):
'''Remove brackets (parentheses) and their contents within a string
Args :
left_paren_type = '[','(' etc
right_paren_type = ']', ')' etc
@sasa1977
sasa1977 / sql_parser.exs
Created October 13, 2019 08:56
Basic SQL parser developed at WebCamp Zagreb, 2019
defmodule SqlParser do
def run() do
input = "select col1 from (
select col2, col3 from (
select col4, col5, col6 from some_table
)
)
"
IO.puts("input: #{inspect(input)}\n")
IO.inspect(parse(input))
@korakot
korakot / selenium.py
Last active March 26, 2024 07:40
Use selenium in Colab
# install chromium, its driver, and selenium
!apt update
!apt install libu2f-udev libvulkan1
!wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
!dpkg -i google-chrome-stable_current_amd64.deb
!wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/118.0.5993.70/linux64/chromedriver-linux64.zip
!unzip -j chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/
!pip install selenium chromedriver_autoinstaller
# set options to be headless, ..
@vraravam
vraravam / osx-defaults.sh
Last active March 17, 2024 01:21
OSX Defaults to setup a brand new machine
#!/usr/bin/env bash
# TODO: Need to figure out the settings for the following:
# 1) Dock: Items with order (not capturing binary data - since that is dependent on installed apps)
# 2) Security & Privacy Preferences: Full Disk Access, Camera, Microphone
# 3) Login items for my user (i.e. apps started when I login)
# 4) Retina displays scaling
# 5) Finder sidebar with order
##
@rjorgenson
rjorgenson / README.md
Last active June 2, 2020 14:42
Bear Journal

I created these scripts to generate some daily and monthly notes in Bear.

The launchd scripts will run the daily script every day at 3am and the monthly script on the first of every month at 2am. Make sure to update the path to the actual scripts in the launchd scripts before loading them.

mv com.bearjournal.daily.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.bearjournal.daily.plist

mv com.bearjournal.monthly.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.bearjournal.monthly.plist
@jackcrombie
jackcrombie / zapier_wistia_url_upload_api.py
Last active April 3, 2019 08:06
Run this in a code step in Zapier to upload files from their public URL to a wistia Project. This allows us to bypass some of the file size and timeout issues faced when trying to upload large videos (+1GB) to Wistia via dropbox or google drive integrations. I've used Amazon s3 to store the files and serve them to Wistia.
import requests #imports pythons requests library
import json #imports pythons json library
#grab data from previous steps in Zapier
s3URL = input_data['s3URL']
project_id = input_data['projectID']
#print these to logs for troubleshooting while building zaps
print s3URL #prints out s3 url from Airtable
print project_id #prints project ID from Airtable
@geelen
geelen / _.md
Last active March 1, 2019 04:32
Sync a document from Bear Writer's DB to a file on disk

Sync a document from Bear Writer's DB to a file on disk

I really like Bear Writer's interface, but it stores all its notes in an SQLite DB. I spent ages rigging up a nice Markdown + Webpack pipeline for a React blog before I realised this, and rather than admit my mistake, potentially pushing forward to concentrate on the content rather than procrastinating on the pipeline, I built this.

Screenshot showing copying the doc id

Grab the Document ID from Bear, then run:

yarn add sqlite3 untildify
@bsedat
bsedat / Dockerfile
Last active August 8, 2023 05:56
Elixir Phoenix Umbrella App + Distillery Multistage Docker Build
FROM elixir:1.4.5 as asset-builder-mix-getter
ENV HOME=/opt/app
RUN mix do local.hex --force, local.rebar --force
# Cache elixir deps
COPY config/ $HOME/config/
COPY mix.exs mix.lock $HOME/
COPY apps/myproject_web/mix.exs $HOME/apps/myproject_web/
COPY apps/myproject_web/config/ $HOME/apps/myproject_web/config/
@kevinelliott
kevinelliott / 1-macOS-10.12-sierra-setup.md
Last active February 5, 2024 07:22
macOS 10.12 Sierra Setup

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o

@yaodong
yaodong / gist:f5b785c5b17337ce1b9a
Created February 11, 2016 23:15
things cloud requests
login
curl -H "Host: cloud.culturedcode.com" -H "Content-Type: application/json; charset=UTF-8" -H "Proxy-Connection: keep-alive" -H "Accept: */*" -H "User-Agent: ThingsMac/20803501mas (x86_64; OS X 10.11.3; en_US)" -H "Authorization: Password pppppwwwwdddd" -H "Accept-Language: en-us" --compressed https://cloud.culturedcode.com/version/1/account/user%40exmaple.com
get key
curl -H "Host: cloud.culturedcode.com" -H "Content-Type: application/json; charset=UTF-8" -H "Proxy-Connection: keep-alive" -H "Accept: */*" -H "User-Agent: ThingsMac/20803501mas (x86_64; OS X 10.11.3; en_US)" -H "Authorization: Password pppppwwwwdddd" -H "Accept-Language: en-us" --compressed https://cloud.culturedcode.com/version/1/account/user%40exmaple.com/own-history-keys
get index
curl -H "Host: cloud.culturedcode.com" -H "Content-Type: application/json; charset=UTF-8" -H "Proxy-Connection: keep-alive" -H "Accept: */*" -H "User-Agent: ThingsMac/20803501mas (x86_64; OS X 10.11.3; en_US)" -H "Accept-Language: en-us" --compressed https: