Skip to content

Instantly share code, notes, and snippets.

@moxie
moxie / generate_certificate.sh
Created May 7, 2021 10:44 — forked from amitsaxena/generate_certificate.sh
Generate a free Let’s Encrypt wildcard SSL certificate for your domain
curl https://get.acme.sh | sh
# Open a new terminal window after executing above command
# Create a cloudflare account and get your API key from the profile section
export CF_Email=my.cloudflare@example.com
export CF_Key=replace_with_cloudflare_api_key
# Generate wildcard certificate for *.example.com
acme.sh --issue -d example.com -d '*.example.com' --dns dns_cf
@moxie
moxie / .htaccess
Created March 14, 2019 20:23 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
SET @a := 0;
SELECT
@a := @a + 1 as "Rank",
tag_id as "Tag ID",
FROM_UNIXTIME(MIN(timestamp), '%H:%i:%S') as "Start Time",
FROM_UNIXTIME(MAX(timestamp), '%H:%i:%S') as "Finish Time",
SEC_TO_TIME(TIMESTAMPDIFF(second, FROM_UNIXTIME(MIN(timestamp)), FROM_UNIXTIME(MAX(timestamp)))) as "Total Time",
SEC_TO_TIME(TIMESTAMPDIFF(second, FROM_UNIXTIME(MIN(timestamp)), FROM_UNIXTIME(MAX(timestamp))) / 3.1) as "Pace",
TIMESTAMPDIFF(second, FROM_UNIXTIME(MIN(timestamp)), FROM_UNIXTIME(MAX(timestamp))) as "Seconds"
FROM timing_test
-- Given this data
--
-- tag_id timestamp
-- ----------------------
-- Joe 1382637527
-- Joe 1382637934
-- Bob 1382637000
-- Bob 1382637300
-- How can I modify this query to yield rank based on the lowest time to highest
iface eth0 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
@app.directive "countdown", ($timeout) ->
restrict: "E"
link: (scope, element, attrs) ->
timeout_id = $timeout ->
console.log Date()
1000
-- Returns only FL for desired_work_location
SELECT GROUP_CONCAT(resume_locations.location_state) as desired_work_locations
FROM `resumes`
LEFT JOIN `resume_locations` ON `resume_locations`.`resume_id` = `resumes`.`id`
WHERE (resume_locations.location_state = 'FL')
GROUP BY resumes.id
-- Returns FL,NY,AZ,NH for desired_work_locations
SELECT GROUP_CONCAT(resume_locations.location_state) as desired_work_locations
FROM `resumes`
select u.app_id, u.property_id from ad_units u
left join ad_impressions i on i.ad_unit_id = u.id and date(i.date) > '2012-05-01'
where i.id is null
group by u.app_id, u.property_id
select @rn:=@rn+1 as rank, referrals
from (
select count(referrer_id) as referrals, referrer_id from users
where referrer_id is not null
group by referrer_id
order by referrals desc) t1, (select @rn:=0) t2
-- Giving output like this
/* rank referrals
1 100
[6] pry(main)> cd Blog
[7] pry(Blog):1> show-method classify_blogs!
Error: The method 'classify_blogs!' could not be found. Type `show-method --help` for help.
[8] pry(Blog):1> show-method classify_blogs
From: /Users/joe/.rvm/gems/ree-1.8.7-2011.03@ss/gems/pry-0.9.8.1/lib/pry/method.rb @ line 300:
Number of lines: 14
Owner: #<Class:Blog(id: integer, url: string, feed_url: string, canonical_url: string, title: string, description: text, average_daily_visits: decimal, average_daily_visitors: decimal, average_daily_pageviews: decimal, platform_id: string, created_at: datetime, updated_at: datetime, vertical_id: integer, publisher_id: integer, review_status: string, majority_country: string, cost: integer, auth_username: string, foreign_id: string, auth_token: string, auth_secret: string, author_name: string, type: string, screen_name: string, full_name: string, followers_count: integer, stats_updated_at: datetime, ga_status: string, open_offers_count: integer, approved_offers_count: integer, premium: boolean, d