Skip to content

Instantly share code, notes, and snippets.

Stefan Åhman stefanahman

Block or report user

Report or block stefanahman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rails_4_upgrade.md

find_by(*) => where(*).first

Search:

find_by\((.*?)\)$
find_by\((.*?)\)

Replace:

where($1).first
@stefanahman
stefanahman / clear_queues.rb
Created Sep 10, 2018
Remove jobs from Resque queues
View clear_queues.rb
# Active job
queue_name = 'netsuite_low'
class_name = 'PurchaseOrder::ImportSingleFromNetsuiteJob'
active_job_class = 'ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper'
# active_job_class = 'ActiveScheduler::ResqueWrapper'
args = Resque.peek(queue_name,0,10000).select { |job| job['args'].to_s.include?(class_name) }.flat_map{ |job| job['args'] }; nil
args.each { |arg| Resque::Job.destroy(queue_name, active_job_class, arg) }; nil
# Resque
queue_name = 'netsuite'
View firefox-custom-search-engines.json
{
"file_version": "1.0",
"preferences": {
"custom_engines": {
"nsi": {
"name": "NetSuite item",
"url": "https://system.eu2.netsuite.com/app/common/item/item.nl?id={searchTerms[0]}",
"description": ""
},
"nse": {
@stefanahman
stefanahman / teeworlds.service
Created Jan 14, 2018
Tee Worlds docker service
View teeworlds.service
[Unit]
Description=tee world docker container
After=docker.service
Requires=docker.service
[Service]
User=teeworlds
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill teeworlds
ExecStartPre=-/usr/bin/docker rm teeworlds
View factorio.service
[Unit]
Description=factorio docker container
After=docker.service
Requires=docker.service
[Service]
User=factorio
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill factorio
ExecStartPre=-/usr/bin/docker rm factorio
View gist:a2be8383bd2282eb470adc9e845a031a
[Unit]
Description=minecraft docker container
After=docker.service
Requires=docker.service
[Service]
User=minecraft
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill minecraft
ExecStartPre=-/usr/bin/docker rm minecraft
@stefanahman
stefanahman / rspec_upgrade.md
Last active Nov 17, 2017
Sublime: Rspec 2 to Rspec 3
View rspec_upgrade.md

stub => expect

Search:

^(\s*)(.*?).stub\((.*?)\)\.

Replace:

$1expect($2).to receive($3).
@stefanahman
stefanahman / steam-csgo.service
Created Feb 19, 2017
Docker config for cs:go app
View steam-csgo.service
[Unit]
Description=steam csgo launcher docker container
After=docker.service
Requires=docker.service
[Service]
User=steam
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill steam-csgo
ExecStartPre=-/usr/bin/docker rm steam-csgo
@stefanahman
stefanahman / nginx-stefanahman-se.service
Last active Feb 18, 2017
Docker config for personal website
View nginx-stefanahman-se.service
[Unit]
Description=nginx stefanahman.se website docker container
After=docker.service
Requires=docker.service
[Service]
User=nginx
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill nginx-stefanahman-se
ExecStartPre=-/usr/bin/docker rm nginx-stefanahman-se
View keybase.md

Keybase proof

I hereby claim:

  • I am stefanahman on github.
  • I am stefanahman (https://keybase.io/stefanahman) on keybase.
  • I have a public key ASAOfgjkr8XjJXtWUYXWlZAIOdJRFY3I19OojYT2QCZp-go

To claim this, I am signing this object:

You can’t perform that action at this time.