Skip to content

Instantly share code, notes, and snippets.

View sbose78's full-sized avatar
🎯
Focusing

Shoubhik Bose sbose78

🎯
Focusing
View GitHub Profile
@sbose78
sbose78 / gist:a28e23016582ee1e5021791d517d2705
Created April 28, 2017 17:14
nginx module to create 2 websites
In this section, we will create our own learner's NGINX module which can be used to server a couple of websites:
`/etc/hosts/nginx/manifests/init.pp`
```
class nginx {
package { 'nginx': ensure => installed }
127.0.0.1 localhost nextraining.puppet.sbose.in
<% servername.each do |name| -%>
127.0.0.1 <%= name['hostname'] %>
<% end -%>
ode vagrant-ubuntu-trusty-32 {
nginx::vhost::apply{ "web1":
domain => "site1.puppet.sbose.in",
root => "/home/ubuntu/site1"
}
nginx::vhost::apply{"web2":
domain => "site2.puppet.sbose.in",
root => "/home/ubuntu/site2"
}
@sbose78
sbose78 / lamp.pp
Last active April 25, 2017 16:20
lamp puppet manifest
# execute 'apt-get update'
exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}
select * from work_items where fields @> '{"system.remote_item_id":null}'
update work_items set fields = jsonb_set(fields,'{system.remote_item_id}','2',true) where id = 1;
/*
So what I want to do is to give a configuration object to every controller
and the controller can call only specific methods on it.
*/
type SuperInterface interface {
myfunc()
}
#!/bin/bash
mkdir -p converted
for filename in /home/shoubhik/raw-photos-doshomi/*.JPG ; do
source_file=$filename
f=`basename "$filename"`
destination="converted/$f"
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 35% $source_file $destination
echo $destination
done
~
@sbose78
sbose78 / update-version-package.sh
Last active April 11, 2024 19:36
Pre-commit hook to update package.json
#!/bin/bash
set -e
update_version(){
if [[ "$DONT_BUMP_VERSION" -ne "1" ]]
then
echo " Bumping version.. "
else
echo "Version will not be bumped since variable DONT_BUMP_VERSION is set."
exit 0
select * from work_items where
setweight(to_tsvector('english',fields->>'system.title'),'B')||
setweight(to_tsvector('english',fields->>'system.description'),'C')||
setweight(to_tsvector('english', id::text),'A')
@@ to_tsquery('english','description')
CREATE INDEX IF NOT EXISTS fields_title ON work_items USING GIN (to_tsvector(’english’, fields->>'system.title'));
select plainto_tsquery('english','sbose OR http://www.fooofle.com/trtrtrjtr');
select to_tsquery('sbose & ( 53* | www.fooofle.com/trtrtrjtr/454* )');
package remoteworkitem
import (
"encoding/json"
"github.com/almighty/almighty-core/app"
)
// List of supported attributes
const (