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.
@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/