Skip to content

Instantly share code, notes, and snippets.

@wscourge
wscourge / docker functions and aliases
Last active January 4, 2022 10:09
Paste or a linkt to it in the ~/.zshrc file
# Aliases
alias drc='docker-compose'
alias dre='docker exec -it'
# Functions
drirm () {
images=$(docker image ls -f "reference=$1*" -q)
if [[ -z "$images" ]]; then
echo "drirm: ❌ No images matching: \"$1*\"; Aborting."
else
@wscourge
wscourge / countries.sql
Created April 9, 2020 19:52 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@wscourge
wscourge / gist:4bd8b11a5f96cca29c4b2d705d4b50e2
Created April 9, 2020 19:52 — forked from voskobovich/gist:537b2000108e4781f70b
List of most currency ISO code and symbol format in SQL.
DROP TABLE currency;
-- Create table variable
CREATE TABLE currency (
name VARCHAR(20),
code VARCHAR(3),
symbol VARCHAR(5)
);
ALTER TABLE currency CONVERT TO CHARACTER SET utf8;
function accountNumberValidator(accountNumber, countryCode) {
let copy = accountNumber.replace(/[^0-9]+/g, '');
const weights = [
1,
10,
3,
30,
9,
90,
27,
@wscourge
wscourge / jekyll_post.md
Created March 24, 2019 10:49
Jekyll post with all SEO configuration variables

title: 'Example post' published_at: 'Marzec 23, 2019' layout: post categories: example post date: 2019-03-23 20:06:46 +0100 description: >- # this means to ignore newlines until "baseurl:" Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.

@wscourge
wscourge / config_initializers_jekyll.rb
Created March 24, 2019 10:48
Spawn jekkyll watcher on Rails startup, kill it on exit
Rails.logger.info('Start loading rake tasks')
Rails.application.load_tasks
Rails.logger.info('Rake tasks loaded')
Rails.logger.info('Spawning jekyll')
jekyll_pid = Process.fork do
Process.setsid
Rake::Task['jekyll:watch'].invoke
end
Rails.logger.info("Jekyll spawned at pid: #{jekyll_pid}")
@wscourge
wscourge / clear-sidekiq-jobs.sh
Created November 14, 2018 09:20 — forked from wbotelhos/clear-sidekiq-jobs.sh
Clear Sidekiq Jobs
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs