Skip to content

Instantly share code, notes, and snippets.

@clifff
clifff / custom.css
Created April 10, 2023 01:42
Custom CSS to add reply icons to Mastodon website
div.status.status-public.status-reply span.status__visibility-icon .fa-globe::before {
content: " ";
}
div.status.status-unlisted.status-reply span.status__visibility-icon .fa-unlock::before {
content: " ";
}
div.status.status-direct.status-reply span.status__visibility-icon .fa-at::before {
content: " ";
@clifff
clifff / README.md
Last active March 10, 2023 18:58
Post to Mastodon Airtable Script
  • Navigate to https://shakedown.social/settings/applications
  • Click "New Application", name it something like "Airtable"
  • Check off the write:statuses scope and uncheck all the other ones.
  • Click "Submit" at the bottom of the page.
  • Click into the "Airtable" application you just made.
  • Copy the value for "Your access token". Paste it into ACCESS_TOKEN_HERE in the script.
  • Populate STATUS_TEXT_HERE in the script with that status text you want.
@clifff
clifff / add_auto_increment_to_int_single_pk.sql
Created January 11, 2019 20:39 — forked from carlosrobles/add_auto_increment_to_int_single_pk.sql
Add auto_increment to all the single PRIMARY KEY of type int of a database
DROP TABLE if exists temp;
CREATE TABLE temp (
`table` varchar(250) DEFAULT NULL,
`colum` varchar(250) DEFAULT NULL,
`type` varchar(250) DEFAULT NULL,
`number_of_PK` tinyint(2) DEFAULT NULL,
`alter` varchar(250) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@clifff
clifff / client_user_data.txt
Last active August 29, 2015 13:58
Private WPT setup
wpt_server=YOUR_PUBLIC_DNS wpt_location=EC2-WPT
@clifff
clifff / dogs.markdown
Created October 9, 2013 20:48
dog gifs

1.9.3p392 :003 > arr = []; arr[10000000000000001] = 1
irb(16545,0x7fff795b9180) malloc: *** mmap(size=80000000000004096) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
irb(16545,0x7fff795b9180) malloc: *** mmap(size=80000000000004096) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
NoMemoryError: failed to allocate memory
from (irb):3:in `[]='
from (irb):3
@clifff
clifff / C-large-1.in
Created April 21, 2013 16:33
Google Code Jam - Fair and Square Large Input 1
10001
1002001 1004006004002
14541 102030301
44944 1022325232202
1000001999901 1211124711121
2617287827163 4000008000005
1 101
1022325232201 1213326733121
44943 12345654321
42874 103045301
@clifff
clifff / palindrome.rb
Last active December 16, 2015 07:49
string vs integer palindrome benchmarks
require 'benchmark'
def int_pal?(num)
n = num
reverse = 0
while (num > 0)
dig = num % 10
reverse = reverse * 10 + dig
num = num / 10
end
@clifff
clifff / comments.json
Last active December 12, 2015 01:38
Comment mapping
This file has been truncated, but you can view the full file.
{"1359925200":[{"timestamp":1359925200,"community_id":117,"lat":38.0,"long":-97.0},{"timestamp":1359925200,"community_id":46,"lat":40.675899505615234,"long":-73.7968978881836},{"timestamp":1359925200,"community_id":378,"lat":41.777000427246094,"long":-72.52359771728516},{"timestamp":1359925200,"community_id":260,"lat":42.72840118408203,"long":-73.69180297851562},{"timestamp":1359925200,"community_id":111,"lat":39.896400451660156,"long":-75.34629821777344},{"timestamp":1359925200,"community_id":162,"lat":30.452699661254883,"long":-91.06780242919922},{"timestamp":1359925200,"community_id":25,"lat":40.04859924316406,"long":-83.07260131835938},{"timestamp":1359925200,"community_id":270,"lat":41.70389938354492,"long":-72.54609680175781},{"timestamp":1359925200,"community_id":242,"lat":42.208099365234375,"long":-70.7750015258789},{"timestamp":1359925200,"community_id":144,"lat":39.16529846191406,"long":-86.52639770507812},{"timestamp":1359925200,"community_id":373,"lat":34.81679916381836,"long":-86.68250274658203},
@clifff
clifff / gist:4171017
Created November 29, 2012 18:39
URI.parse vs regex
require 'URI'
require 'benchmark'
include Benchmark
urls = %W{
http://www.theverge.com/posts/comment
http://www.thefalcoholic.com/posts/ajax_comments_update/3468659?last_version=128
http://www.polygon.com/game/dead-island-riptide/3635
http://www.arrowheadpride.com/rss2/index.xml
http://www.broadstreethockey.com/